reviewboard.accounts.managers¶
Managers for accounts models.
- class LocalSiteProfileManager(*args, **kwargs)[source]¶
Bases:
Manager
Manager for Local Site profiles.
- for_user(user, profile, local_site, create_if_missing=False)[source]¶
Return the Local Site profile for the given user and site.
New in version 5.0.
- Parameters:
user (
django.contrib.auth.models.User
) – The user to get the profile for.profile (
reviewboard.accounts.models.Profile
) – The user’s global profile.local_site (
reviewboard.site.models.LocalSite
) – The Local Site to get the profile for. This may beNone
.create_if_missing (
bool
, optional) – Whether to create the LocalSiteProfile if it is missing.
- Returns:
A two-tuple, containing:
The
LocalSiteProfile
A
bool
indicating whether the profile is newly created.
- Return type:
- Raises:
reviewboard.accounts.models.LocalSiteProfile.DoesNotExist – If
create_if_missing
is False and the profile does not exist, this can be raised.
- __slotnames__ = []¶
- class ProfileManager(*args, **kwargs)[source]¶
Bases:
Manager
Manager for user profiles.
- get_or_create(user, *args, **kwargs)[source]¶
Return the profile for the user.
This will create the profile if one does not exist.
- __annotations__ = {}¶
- __slotnames__ = []¶
- class ReviewRequestVisitManager(*args, **kwargs)[source]¶
Bases:
Manager
Manager for review request visits.
- unarchive_all(review_request)[source]¶
Unarchive a review request for all users.
Unarchives the given review request for all users by changing all review request visit database entries for this review request from archived to visible.
- Parameters:
review_request (
reviewboard.reviews.models.review_request.ReviewRequest
) – The review request to unarchive.
- update_visibility(review_request, user, new_visibility)[source]¶
Update the visibility of a review request.
This will set the review request as visible, archived, or muted for the given user.
- Parameters:
review_request (
reviewboard.reviews.models.review_request.ReviewRequest
) – The review request to update the visibility of.user (
django.contrib.auth.models.User
) – The current user.new_visibility (
unicode
) – The new visibility to update the review request to. This will be one ofVISIBLE
,ARCHIVED
, orMUTED
.
- Returns:
The review request visit.
- Return type:
- __annotations__ = {}¶
- __slotnames__ = []¶
- class TrophyManager(*args, **kwargs)[source]¶
Bases:
Manager
Manager for trophies.
Creates new trophies, updates the database and fetches trophies from the database.
- compute_trophies(review_request)[source]¶
Compute and return trophies for a review request.
Computes trophies for a given review request by looping through all registered trophy types and seeing if any apply to the review request.
If trophies are to be awarded, they are saved in the database and returned. If no trophies are to be awarded, an empty list is returned.
- __annotations__ = {}¶
- __slotnames__ = []¶