Jump to >

reviewboard.accounts.models

Models for user profiles and related objects.

class ReviewRequestVisit(*args, **kwargs)[source]

Bases: django.db.models.base.Model

A recording of the last time a review request was visited by a user.

Users have one ReviewRequestVisit entry in the database per review request they’ve visited. This is used to keep track of any updates to review requests they’ve already seen, so that we can intelligently inform them that new discussions have taken place.

VISIBLE = 'V'[source]
ARCHIVED = 'A'[source]
MUTED = 'M'[source]
VISIBILITY = (('V', 'Visible'), ('A', 'Archived'), ('M', 'Muted'))[source]
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 a ForwardManyToOneDescriptor instance.

review_request[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 a ForwardManyToOneDescriptor instance.

timestamp[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

visibility[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <reviewboard.accounts.managers.ReviewRequestVisitManager object>[source]
__str__()[source]

Return a string used for the admin site listing.

get_next_by_timestamp(*, field=<django.db.models.fields.DateTimeField: timestamp>, is_next=True, **kwargs)
get_previous_by_timestamp(*, field=<django.db.models.fields.DateTimeField: timestamp>, is_next=False, **kwargs)
get_visibility_display(*, field=<django.db.models.fields.CharField: visibility>)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

review_request_id
user_id
class LinkedAccount(*args, **kwargs)[source]

Bases: django.db.models.base.Model

A linked account on an external service.

This can be used to associate user accounts on Review Board with accounts on external services. These services might be third parties that Review Board interacts with (such as hosting services), or alternative methods of authentication like OpenID or SAML.

New in version 5.0.

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 a ForwardManyToOneDescriptor instance.

service_id[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

service_user_id[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

service_data[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

extra_data[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

__annotations__ = {}
get_extra_data_json()
get_service_data_json()
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
set_extra_data_json(json)
set_service_data_json(json)
user_id
class Profile(*args, **kwargs)[source]

Bases: django.db.models.base.Model

User profile which contains some basic configurable settings.

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 a ForwardManyToOneDescriptor instance.

first_time_setup_done[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

should_send_email[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

should_send_own_updates[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

collapsed_diffs[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

wordwrapped_diffs[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

syntax_highlighting[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_private[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

open_an_issue[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

default_use_rich_text[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

show_closed[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

sort_review_request_columns[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

sort_dashboard_columns[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

sort_submitter_columns[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

sort_group_columns[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_columns[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

dashboard_columns[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

submitter_columns[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

group_columns[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

starred_review_requests[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 and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

starred_groups[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 and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

timezone[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

settings[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

extra_data[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <reviewboard.accounts.managers.ProfileManager object>[source]
property should_use_rich_text[source]

Get whether rich text should be used by default for this user.

If the user has chosen whether or not to use rich text explicitly, then that choice will be respected. Otherwise, the system default is used.

property should_enable_desktop_notifications[source]

Return whether desktop notifications should be used for this user.

If the user has chosen whether or not to use desktop notifications explicitly, then that choice will be respected. Otherwise, we enable desktop notifications by default.

Returns

If the user has set whether they wish to receive desktop notifications, then use their preference. Otherwise, we return True.

Return type

bool

get_starred_review_groups_count(*, local_site=None)[source]

The number of starred review groups.

This value is computed and stored in shared cache, to reduce lookups.

New in version 5.0.

Parameters

or (local_site (reviewboard.site.models.LocalSite) –

reviewboard.site.models.LocalSite.ALL or

int, optional):

The Local Site associated with the starred review groups, or LocalSite.ALL to return counts across all sites.

If not set, this will return a count for the global site.

Returns

The starred review group count.

Return type

int

get_starred_review_requests_count(*, local_site=None)[source]

The number of starred review requests.

This value is computed and stored in shared cache, to reduce lookups.

New in version 5.0.

Parameters

or (local_site (reviewboard.site.models.LocalSite) –

reviewboard.site.models.LocalSite.ALL or

int, optional):

The Local Site or ID associated with the starred review requests, or LocalSite.ALL to return counts across all sites.

If not set, this will return a count for the global site.

Returns

The starred review request count.

Return type

int

has_starred_review_groups(*, local_site=None)[source]

Whether the user has starred review groups.

The result is based on a shared cache, to reduce lookups.

New in version 5.0.

Parameters

or (local_site (reviewboard.site.models.LocalSite) –

reviewboard.site.models.LocalSite.ALL or

int, optional):

The Local Site or ID associated with the starred review groups, or LocalSite.ALL to return counts across all sites.

If not set, this will return a count for the global site.

Returns

True if the user has starred review groups. False if the user does not.

Return type

bool

has_starred_review_requests(*, local_site=None)[source]

Whether the user has starred review requests.

The result is based on a shared cache, to reduce lookups.

New in version 5.0.

Parameters

or (local_site (reviewboard.site.models.LocalSite) –

reviewboard.site.models.LocalSite.ALL or

int, optional):

The Local Site or ID associated with the starred review requests, or LocalSite.ALL to return counts across all sites.

If not set, this will return a count for the global site.

Returns

True if the user has starred review requests. False if the user does not.

Return type

bool

is_review_group_starred(review_group)[source]

Return whether a review group has been starred.

New in version 5.0.

Parameters

review_group (reviewboard.reviews.models.Group) – The review group to check.

Returns

True if the review group has been starred. False if it has not.

Return type

bool

is_review_request_starred(review_request)[source]

Return whether a review request has been starred.

New in version 5.0.

Parameters

review_request (reviewboard.reviews.models.ReviewRequest) – The review request to check.

Returns

True if the review request has been starred. False if it has not.

Return type

bool

star_review_request(review_request)[source]

Star a review request.

This will mark a review request as starred for this user and immediately save to the database.

Parameters

review_request (reviewboard.reviews.models.ReviewRequest) – The review request to star.

unstar_review_request(review_request)[source]

Unstar a review request.

This will mark a review request as unstarred for this user and immediately save to the database.

Parameters

review_request (reviewboard.reviews.models.ReviewRequest) – The review request to unstar.

star_review_group(review_group)[source]

Star a review group.

This will mark a review group as starred for this user and immediately save to the database.

Parameters

review_group (reviewboard.reviews.models.Group) – The review group to star.

unstar_review_group(review_group)[source]

Unstar a review group.

This will mark a review group as unstarred for this user and immediately save to the database.

Parameters

review_group (reviewboard.reviews.models.Group) – The review group to unstar.

__str__()[source]

Return a string used for the admin site listing.

property avatar_service[source]

The avatar service the user has selected.

Returns

The avatar service.

Return type

djblets.avatars.services.base.AvatarService

get_display_name(viewing_user)[source]

Return the name to display to the given user.

If any of the following is True and the user this profile belongs to has a full name set, the display name will be the the user’s full name:

  • The viewing user is authenticated and this profile is public.

  • The viewing user is the user this profile belongs to.

  • The viewing user is an administrator.

  • The viewing user is a LocalSite administrator on any LocalSite for which the user whose this profile belongs to is a user.

Otherwise the display name will be the user’s username.

Parameters

viewing_user (django.contrib.auth.models.User) – The user who is viewing the profile.

Returns

The name to display.

Return type

unicode

save(*args, **kwargs)[source]

Save the profile to the database.

The profile will only be saved if the user is not affected by read-only mode.

Parameters
  • *args (tuple) – Positional arguments to pass through to the superclass.

  • **kwargs (dict) – Keyword arguments to pass through to the superclass.

__annotations__ = {}
get_extra_data_json()
get_settings_json()
get_timezone_display(*, field=<django.db.models.fields.CharField: timezone>)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

set_extra_data_json(json)
set_settings_json(json)
site_profiles

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 a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

user_id
class LocalSiteProfile(*args, **kwargs)[source]

Bases: django.db.models.base.Model

User profile information specific to a LocalSite.

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 a ForwardManyToOneDescriptor instance.

profile[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 a ForwardManyToOneDescriptor 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 a ForwardManyToOneDescriptor instance.

permissions[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

direct_incoming_request_count = <djblets.db.fields.counter_field.CounterField: direct_incoming_request_count>[source]
total_incoming_request_count = <djblets.db.fields.counter_field.CounterField: total_incoming_request_count>[source]
pending_outgoing_request_count = <djblets.db.fields.counter_field.CounterField: pending_outgoing_request_count>[source]
total_outgoing_request_count = <djblets.db.fields.counter_field.CounterField: total_outgoing_request_count>[source]
starred_public_request_count = <djblets.db.fields.counter_field.CounterField: starred_public_request_count>[source]
objects = <reviewboard.accounts.managers.LocalSiteProfileManager object>[source]
__str__()[source]

Return a string used for the admin site listing.

__annotations__ = {}
decrement_direct_incoming_request_count(*args, **kwargs)
decrement_pending_outgoing_request_count(*args, **kwargs)
decrement_starred_public_request_count(*args, **kwargs)
decrement_total_incoming_request_count(*args, **kwargs)
decrement_total_outgoing_request_count(*args, **kwargs)
get_permissions_json()
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

increment_direct_incoming_request_count(*args, **kwargs)
increment_pending_outgoing_request_count(*args, **kwargs)
increment_starred_public_request_count(*args, **kwargs)
increment_total_incoming_request_count(*args, **kwargs)
increment_total_outgoing_request_count(*args, **kwargs)
local_site_id
profile_id
reinit_direct_incoming_request_count()
reinit_pending_outgoing_request_count()
reinit_starred_public_request_count()
reinit_total_incoming_request_count()
reinit_total_outgoing_request_count()
reload_direct_incoming_request_count()
reload_pending_outgoing_request_count()
reload_starred_public_request_count()
reload_total_incoming_request_count()
reload_total_outgoing_request_count()
set_permissions_json(json)
user_id
class Trophy(*args, **kwargs)[source]

Bases: django.db.models.base.Model

A trophy represents an achievement given to the user.

It is associated with a ReviewRequest and a User and can be associated with a LocalSite.

category[source]

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

received_date[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 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 a ForwardManyToOneDescriptor 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 a ForwardManyToOneDescriptor instance.

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 a ForwardManyToOneDescriptor instance.

objects = <reviewboard.accounts.managers.TrophyManager object>[source]
trophy_type[source]

The TrophyType instance for this trophy.

get_display_text()[source]

Get the display text for this trophy.

__annotations__ = {}
get_next_by_received_date(*, field=<django.db.models.fields.DateTimeField: received_date>, is_next=True, **kwargs)
get_previous_by_received_date(*, field=<django.db.models.fields.DateTimeField: received_date>, is_next=False, **kwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

local_site_id
review_request_id
user_id