reviewboard.accounts.models¶
Models for user profiles and related objects.
- class AnonymousUser¶
Bases:
object- id = None¶
- pk = None¶
- username = ''¶
- is_staff = False¶
- is_active = False¶
- is_superuser = False¶
- __str__()¶
Return str(self).
- __eq__(other)¶
Return self==value.
- __hash__()¶
Return hash(self).
- __int__()¶
- save()¶
- delete()¶
- set_password(raw_password)¶
- check_password(raw_password)¶
- property groups¶
- property user_permissions¶
- get_user_permissions(obj=None)¶
- async aget_user_permissions(obj=None)¶
- get_group_permissions(obj=None)¶
- async aget_group_permissions(obj=None)¶
- get_all_permissions(obj=None)¶
- async aget_all_permissions(obj=None)¶
- has_perm(perm, obj=None)¶
- async ahas_perm(perm, obj=None)¶
- has_perms(perm_list, obj=None)¶
- async ahas_perms(perm_list, obj=None)¶
- has_module_perms(module)¶
- async ahas_module_perms(module)¶
- property is_anonymous¶
- property is_authenticated¶
- get_username()¶
- class LinkedAccount(*args, **kwargs)[source]¶
Bases:
ModelA 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.parentis aForwardManyToOneDescriptorinstance.
- 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.
- 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 LocalSiteProfile(*args, **kwargs)[source]¶
Bases:
ModelUser 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.parentis aForwardManyToOneDescriptorinstance.
- 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.parentis aForwardManyToOneDescriptorinstance.
- 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.parentis aForwardManyToOneDescriptorinstance.
- 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: ClassVar[LocalSiteProfileManager] = <reviewboard.accounts.managers.LocalSiteProfileManager object>¶
- 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 Profile(*args, **kwargs)[source]¶
Bases:
ModelUser 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.parentis aForwardManyToOneDescriptorinstance.
- 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.toppingsandTopping.pizzasareManyToManyDescriptorinstances.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.toppingsandTopping.pizzasareManyToManyDescriptorinstances.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: ClassVar[ProfileManager] = <reviewboard.accounts.managers.ProfileManager object>¶
- star_cache: dict[tuple[type[StarrableObject], Any], bool]¶
A local cache mapping starrable objects to explicit star states.
When checking if an object is starred, this cache will be checked first. If an object is present, its state will take priority over anything in the database.
- property should_confirm_ship_it: bool[source]¶
Whether to prompt to confirm publishing a Ship It! review.
New in version 7.1.
- 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.
Changed in version 7.1: This property can now be changed.
- Type:
bool– If the user has set whether they wish to receive desktop notifications, then use their preference. Otherwise, we returnTrue.
- property quick_access_actions: Sequence[str][source]¶
The IDs of the user’s enabled Quick Access actions.
New in version 7.1.
- get_starred_review_groups_count(*, local_site: ~typing.Union[~reviewboard.site.models.LocalSite, None, ~typing.Literal[<_LocalSiteConstants.ALL: '<ALL>'>], int] = None) int[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.ALLto 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:
- get_starred_review_requests_count(*, local_site: ~typing.Union[~reviewboard.site.models.LocalSite, None, ~typing.Literal[<_LocalSiteConstants.ALL: '<ALL>'>], int] = None) int[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.ALLto 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:
- has_starred_review_groups(*, local_site: ~typing.Union[~reviewboard.site.models.LocalSite, None, ~typing.Literal[<_LocalSiteConstants.ALL: '<ALL>'>], int] = None) bool[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.ALLto return counts across all sites.If not set, this will return a count for the global site.
- Returns:
Trueif the user has starred review groups.Falseif the user does not.- Return type:
- has_starred_review_requests(*, local_site: ~typing.Union[~reviewboard.site.models.LocalSite, None, ~typing.Literal[<_LocalSiteConstants.ALL: '<ALL>'>], int] = None) bool[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.ALLto return counts across all sites.If not set, this will return a count for the global site.
- Returns:
Trueif the user has starred review requests.Falseif the user does not.- Return type:
- is_object_starred(obj: Union[Group, ReviewRequest]) bool[source]¶
Return whether a starrable object has been starred.
This will look up in the local cache, if available. Otherwise it will fall back to querying the database.
New in version 7.1.
- Parameters:
obj (
StarrableObject) – The object to check.- Returns:
Trueif the object is starred.Falseif it is not.- Return type:
- Raises:
ValueError – The provided object is not a starrable object.
- is_review_group_starred(review_group: Group) bool[source]¶
Return whether a review group has been starred.
This will look up in the local cache, if available. Otherwise it will fall back to querying the database.
New in version 5.0.
- Parameters:
review_group (
reviewboard.reviews.models.Group) – The review group to check.- Returns:
Trueif the review group has been starred.Falseif it has not.- Return type:
- is_review_request_starred(review_request: ReviewRequest) bool[source]¶
Return whether a review request has been starred.
This will look up in the local cache, if available. Otherwise it will fall back to querying the database.
New in version 5.0.
- Parameters:
review_request (
reviewboard.reviews.models.ReviewRequest) – The review request to check.- Returns:
Trueif the review request has been starred.Falseif it has not.- Return type:
- star_review_request(review_request: ReviewRequest) None[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: ReviewRequest) None[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: Group) None[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: Group) None[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.
- prefetch_starred_objects(model: type[Union[reviewboard.reviews.models.group.Group, reviewboard.reviews.models.review_request.ReviewRequest]], pks: Sequence[Any]) None[source]¶
Pre-fetch the starred status for one or more objects.
This can speed up the lookup of the starred status for groups or review requests, and is recommended when working with bulk lists of these objects.
New in version 7.1.
- prefetch_starred_review_groups(pks: Sequence[Any]) None[source]¶
Pre-fetch the starred status for one or more review group IDs.
This can speed up the lookup of the starred status for groups, and is recommended when working with bulk lists of groups.
New in version 7.1.
- Parameters:
pks (
list) –The list of review group primary keys.
This is expected to be sanitized for ownership and any accessible Local Site.
- prefetch_starred_review_requests(pks: Sequence[Any]) None[source]¶
Pre-fetch the starred status for one or more review request IDs.
This can speed up the lookup of the starred status for review requests, and is recommended when working with bulk lists of review requests.
New in version 7.1.
- Parameters:
pks (
list) –The list of review request primary keys.
This is expected to be sanitized for ownership and any accessible Local Site.
- 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:
- 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.
- 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.childrenis aReverseManyToOneDescriptorinstance.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 ReviewRequestVisit(*args, **kwargs)[source]¶
Bases:
ModelA 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.
- 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.parentis aForwardManyToOneDescriptorinstance.
- 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.parentis aForwardManyToOneDescriptorinstance.
- 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: ClassVar[ReviewRequestVisitManager] = <reviewboard.accounts.managers.ReviewRequestVisitManager object>¶
- 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 Trophy(*args, **kwargs)[source]¶
Bases:
ModelA 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.parentis aForwardManyToOneDescriptorinstance.
- 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.parentis aForwardManyToOneDescriptorinstance.
- 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.parentis aForwardManyToOneDescriptorinstance.
- objects: ClassVar[TrophyManager] = <reviewboard.accounts.managers.TrophyManager object>¶
- 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¶
- class User(*args, **kwargs)¶
Bases:
AbstractUserUsers within the Django authentication system are represented by this model.
Username and password are required. Other fields are optional.
- application_set¶
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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- changedescription_set¶
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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- date_joined¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- default_review_paths¶
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.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- directed_drafts¶
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.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- directed_review_requests¶
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.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- draft¶
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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- email¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- file_attachments¶
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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- first_name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_absolute_url()¶
- get_local_site_stats() UserLocalSiteStats¶
Return statistics on LocalSite membership for this user.
New in version 5.0.
- Returns:
A dictionary of statistics.
- Return type:
- get_next_by_date_joined(*, field=<django.db.models.fields.DateTimeField: date_joined>, is_next=True, **kwargs)¶
- get_previous_by_date_joined(*, field=<django.db.models.fields.DateTimeField: date_joined>, is_next=False, **kwargs)¶
- get_profile(cached_only: bool = False, create_if_missing: bool = True, return_is_new: bool = False) Union[Optional[Profile], tuple[Optional[Profile], bool]]¶
Return the profile for the User.
The profile will be cached, preventing queries for future lookups.
If a profile doesn’t exist in the database, and a cached-only copy isn’t being returned, then a profile will be created in the database.
Changed in version 3.0.12: Added support for
create_if_missingandreturn_is_newarguments.- Parameters:
cached_only (
bool, optional) –Whether we should only return the profile cached for the user.
If True, this function will not retrieve an uncached profile or create one that doesn’t exist. Instead, it will return
None.create_if_missing (
bool, optional) – Whether to create a site profile if one doesn’t already exist.return_is_new (
bool, optional) – IfTrue, the result of the call will be a tuple containing the profile and a boolean indicating if the profile was newly-created.
- Returns:
The user’s profile.
If
return_is_newisTrue, then this will instead return(Profile, is_new).- Return type:
- Raises:
Profile.DoesNotExist – The profile did not exist. This can only be raised if passing
create_if_missing=False.
- get_site_profile(local_site: Optional[LocalSite], cached_only: bool = False, create_if_missing: bool = True, return_is_new: bool = False) Union[Optional[LocalSiteProfile], tuple[Optional[LocalSiteProfile], bool]]¶
Return the LocalSiteProfile for a given LocalSite for the User.
The site profile will be cached, preventing queries for future lookups.
If a site profile doesn’t exist in the database, and a cached-only copy isn’t being returned, then a profile will be created in the database, unless passing
create_if_missing=False.Changed in version 3.0.12:
In previous versions, this would not create a site profile if one didn’t already exist. Now it does, unless passing
create_if_missing=False. This change was made to standardize behavior between this andUser.get_profile().Added support for
cached_only,create_if_missingandreturn_is_newarguments.
- Parameters:
local_site (
reviewboard.site.models.LocalSite) – The LocalSite to return a profile for. This is allowed to beNone, which means the profile applies to their global site account.cached_only (
bool, optional) –Whether we should only return the profile cached for the user.
If True, this function will not retrieve an uncached profile or create one that doesn’t exist. Instead, it will return
None.create_if_missing (
bool, optional) – Whether to create a site profile if one doesn’t already exist.return_is_new (
bool, optional) – IfTrue, the result of the call will be a tuple containing the profile and a boolean indicating if the profile was newly-created.
- Returns:
The user’s LocalSite profile.
If
return_is_newisTrue, then this will instead return(LocalSiteProfile, is_new).- Return type:
- Raises:
LocalSiteProfile.DoesNotExist – The profile did not exist. This can only be raised if passing
create_if_missing=False.
- groups¶
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.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- has_private_profile() bool¶
Return whether the user’s profile is marked as private.
New in version 5.0.
- Returns:
Whether the user’s profile is marked as private.
- Return type:
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_active¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_admin_for_user(user: Optional[Union[AnonymousUser, User]]) bool¶
Return whether this user is an administrator for the given user.
Results will be cached for this user so that at most one query is done.
- Parameters:
user (
django.contrib.auth.models.User) – The user to check.- Returns:
Whether or not this user is an administrator for the given user.
- Return type:
- is_profile_visible(user: Optional[User] = None) bool¶
Return whether or not the given user can view this user’s profile.
Profiles are hidden from unauthenticated users. For authenticated users, a profile is visible if one of the following is true:
The profile is not marked as private.
The viewing user owns the profile.
The viewing user is a staff member.
The viewing user is an administrator on a Local Site which the viewed user is a member.
- Parameters:
user (
django.contrib.auth.models.User, optional) – The user for which visibility to the profile is to be determined.- Returns:
Whether or not the given user can view the profile.
- Return type:
- is_staff¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_superuser¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- last_login¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- last_name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- linked_accounts¶
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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- local_site¶
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.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- local_site_admins¶
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.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- logentry_set¶
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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- oauth2_provider_accesstoken¶
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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- oauth2_provider_application¶
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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- oauth2_provider_devicegrant¶
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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- oauth2_provider_grant¶
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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- oauth2_provider_idtoken¶
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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- oauth2_provider_refreshtoken¶
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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- oauth_application¶
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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- password¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- profile_set¶
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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- repositories¶
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.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- review_groups¶
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.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- review_request_visits¶
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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- review_requests¶
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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- reviews¶
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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- should_send_email() bool¶
Return whether a user wants to receive e-mails.
This is patched into the user object to make it easier to deal with missing Profile objects.
- Returns:
Trueif the user wants to receive e-mails.Falseif they do not.- Return type:
- should_send_own_updates() bool¶
Return whether a user wants to receive e-mails about their activity.
This is patched into the user object to make it easier to deal with missing Profile objects.
- Returns:
Trueif the user wants to receive e-mails about their own activity.Falseif they do not.- Return type:
- 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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- status_updates¶
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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- storedconsentdata¶
Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurantis aReverseOneToOneDescriptorinstance.
- trophies¶
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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- user_permissions¶
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.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- username¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- webapi_tokens¶
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.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- class UserLocalSiteStats[source]¶
Bases:
TypedDictStatistics about a user’s Local Site relationships.
New in version 7.1.
- admined_local_site_ids: Sequence[int]¶
The list of IDs of LocalSites for which the user is an administrator.
- local_site_ids: Sequence[int]¶
The list of IDs of LocalSites for which the user is a member.
This may or may not be a subset of
admined_local_site_ids.
- state_uuid: str¶
A UUID representing the current generation of statistics.
This is suitable for use in other cache keys.
This will be updated any time a new set of stats is created (i.e., when first generated, when invalidated, or when it expires from cache), even if the actual data does not change.
- __closed__ = None¶
- __extra_items__ = typing_extensions.NoExtraItems¶
- __mutable_keys__ = frozenset({'admined_local_site_ids', 'local_site_ids', 'state_uuid'})¶
- __optional_keys__ = frozenset({})¶
- __readonly_keys__ = frozenset({})¶
- __required_keys__ = frozenset({'admined_local_site_ids', 'local_site_ids', 'state_uuid'})¶
- __total__ = True¶