reviewboard.attachments.models¶
-
class
FileAttachmentHistory
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Revision history for a single file attachment.
This tracks multiple revisions of the same file attachment (for instance, when someone replaces a screenshot with an updated version).
-
display_position
[source]¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
latest_revision
= <djblets.db.fields.relation_counter_field.RelationCounterField: latest_revision>[source]¶
-
static
compute_next_display_position
(review_request)[source]¶ Compute the display position for a new FileAttachmentHistory.
-
file_attachments
[source]¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
id
[source]¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
review_request
[source]¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
pizza.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
-
class
FileAttachment
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
A file associated with a review request.
Like diffs, a file can have comments associated with it. These comments are of type
reviewboard.reviews.models.FileAttachmentComment
.-
caption
[source]¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
draft_caption
[source]¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
orig_filename
[source]¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
user
[source]¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
local_site
[source]¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
uuid
[source]¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
file
[source]¶ The descriptor for the file attribute on the model instance. Returns a FieldFile when accessed so you can do stuff like:
>>> from myapp.models import MyModel >>> instance = MyModel.objects.get(pk=1) >>> instance.file.size
Assigns a file object on assignment so you can do:
>>> with open('/path/to/hello.world', 'r') as f: ... instance.file = File(f)
-
mimetype
[source]¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
repo_path
[source]¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
repo_revision
[source]¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
repository
[source]¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
added_in_filediff
[source]¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
attachment_history
[source]¶ Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
attachment_revision
[source]¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
is_accessible_by
(user)[source]¶ Returns whether or not the user has access to this FileAttachment.
This checks that the user has access to the LocalSite if the attachment is associated with a local site. This is only applicable for user owned file attachments.
-
is_mutable_by
(user)[source]¶ Returns whether or not a user can modify this FileAttachment.
This checks that the user is either a superuser or the owner of the file attachment. This is only applicable for user owned file attachments.
-
added_in_filediff_id
[source]¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
attachment_history_id
[source]¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
comments
[source]¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
diffed_against_comments
[source]¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
drafts
[source]¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
pizza.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
id
[source]¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
inactive_drafts
[source]¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
pizza.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
inactive_review_request
[source]¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
pizza.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
local_site_id
[source]¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
repository_id
[source]¶ A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
-
review_request
[source]¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
pizza.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
-
get_latest_file_attachments
(file_attachments)[source]¶ Filter the list of file attachments to only return the latest revisions.
Parameters: file_attachments (list of reviewboard.attachments.models.FileAttachment) – The file attachments to filter. Returns: The list of file attachments that are the latest revisions in their respective histories. Return type: list of reviewboard.attachments.models.FileAttachment