distro_tracker.accounts

The app implements Distro Tracker accounts and their management.

distro_tracker.accounts.models

Models for the distro_tracker.accounts app.

class distro_tracker.accounts.models.User(*args, **kwargs)[source]

Bases: django_email_accounts.models.User

Proxy model for django_email_accounts.models.User extending it with some Distro Tracker specific methods.

is_subscribed_to(package)[source]

Checks if the user is subscribed to the given package. The user is considered subscribed if at least one of its associated emails is subscribed.

Parameters

package (string or distro_tracker.core.models.PackageName) – The name of the package or a package instance

unsubscribe_all(email=None)[source]

Terminate the user’s subscription associated to the given email. Uses the main email if not specified.

exception DoesNotExist

Bases: django_email_accounts.models.User.DoesNotExist

exception MultipleObjectsReturned

Bases: django_email_accounts.models.User.MultipleObjectsReturned

distro_tracker.accounts.views

Views for the distro_tracker.accounts app.

class distro_tracker.accounts.views.ConfirmationRenderMixin[source]

Bases: object

get_confirmation_email_content(confirmation)[source]
class distro_tracker.accounts.views.LoginView(**kwargs)[source]

Bases: django_email_accounts.views.LoginView

success_url = '/accounts/profile/'
class distro_tracker.accounts.views.LogoutView(**kwargs)[source]

Bases: django_email_accounts.views.LogoutView

success_url = '/'
class distro_tracker.accounts.views.RegisterUser(**kwargs)[source]

Bases: distro_tracker.accounts.views.ConfirmationRenderMixin, django_email_accounts.views.RegisterUser

success_url = '/accounts/register/success/'
confirmation_email_subject = 'Example Package Tracker Registration Confirmation'
confirmation_email_from_address = 'noreply@tracker.example.net'
class distro_tracker.accounts.views.RegistrationConfirmation(**kwargs)[source]

Bases: django_email_accounts.views.RegistrationConfirmation

success_url = '/accounts/profile/'
message = 'You have successfully registered to the Example Package Tracker'
class distro_tracker.accounts.views.ResetPasswordView(**kwargs)[source]

Bases: distro_tracker.accounts.views.ConfirmationRenderMixin, django_email_accounts.views.ResetPasswordView

success_url = '/accounts/profile/'
class distro_tracker.accounts.views.ForgotPasswordView(**kwargs)[source]

Bases: distro_tracker.accounts.views.ConfirmationRenderMixin, django_email_accounts.views.ForgotPasswordView

success_url = '/accounts/+reset-password/+success/'
confirmation_email_subject = 'Example Package Tracker Password Reset Confirmation'
confirmation_email_from_address = 'noreply@tracker.example.net'
class distro_tracker.accounts.views.ChangePersonalInfoView(**kwargs)[source]

Bases: django_email_accounts.views.ChangePersonalInfoView

success_url = '/accounts/profile/modify/'
class distro_tracker.accounts.views.PasswordChangeView(**kwargs)[source]

Bases: django_email_accounts.views.PasswordChangeView

success_url = '/accounts/profile/password-change/'
class distro_tracker.accounts.views.AccountProfile(**kwargs)[source]

Bases: django_email_accounts.views.AccountProfile

class distro_tracker.accounts.views.ManageAccountEmailsView(**kwargs)[source]

Bases: distro_tracker.accounts.views.ConfirmationRenderMixin, django_email_accounts.views.ManageAccountEmailsView

success_url = '/accounts/+manage-emails/'
merge_accounts_url = '/accounts/+merge-accounts/confirm/'
confirmation_email_subject = 'Add Email To Example Package Tracker Account'
confirmation_email_from_address = 'noreply@tracker.example.net'
class distro_tracker.accounts.views.AccountMergeConfirmView(**kwargs)[source]

Bases: distro_tracker.accounts.views.ConfirmationRenderMixin, django_email_accounts.views.AccountMergeConfirmView

success_url = '/accounts/+merge-accounts/confirmed/'
confirmation_email_subject = 'Merge Example Package Tracker Accounts'
confirmation_email_from_address = 'noreply@tracker.example.net'
class distro_tracker.accounts.views.AccountMergeFinalize(**kwargs)[source]

Bases: django_email_accounts.views.AccountMergeFinalize

success_url = '/accounts/+merge-accounts/finalized/'
class distro_tracker.accounts.views.AccountMergeConfirmedView(**kwargs)[source]

Bases: django_email_accounts.views.AccountMergeConfirmedView

template_name = 'accounts/tracker-accounts-merge-confirmed.html'
class distro_tracker.accounts.views.ConfirmAddAccountEmail(**kwargs)[source]

Bases: django_email_accounts.views.ConfirmAddAccountEmail

class distro_tracker.accounts.views.SubscriptionsView(**kwargs)[source]

Bases: django_email_accounts.views.LoginRequiredMixin, django.views.generic.base.View

Displays a user’s subscriptions.

This includes both direct package subscriptions and team memberships.

template_name = 'accounts/subscriptions.html'
get(request)[source]
class distro_tracker.accounts.views.UserEmailsView(**kwargs)[source]

Bases: django_email_accounts.views.LoginRequiredMixin, django.views.generic.base.View

Returns a JSON encoded list of the currently logged in user’s emails.

get(request)[source]
class distro_tracker.accounts.views.SubscribeUserToPackageView(**kwargs)[source]

Bases: django_email_accounts.views.LoginRequiredMixin, django.views.generic.base.View

Subscribes the user to a package.

The user whose email address is provided must currently be logged in.

post(request)[source]
class distro_tracker.accounts.views.UnsubscribeUserView(**kwargs)[source]

Bases: django_email_accounts.views.LoginRequiredMixin, django.views.generic.base.View

Unsubscribes the currently logged in user from the given package. An email can be optionally provided in which case only the given email is unsubscribed from the package, if the logged in user owns it.

post(request)[source]
class distro_tracker.accounts.views.UnsubscribeAllView(**kwargs)[source]

Bases: django_email_accounts.views.LoginRequiredMixin, django.views.generic.base.View

The view unsubscribes the currently logged in user from all packages. If an optional email POST parameter is provided, only removes all subscriptions for the given emails.

post(request)[source]
class distro_tracker.accounts.views.ChooseSubscriptionEmailView(**kwargs)[source]

Bases: django_email_accounts.views.LoginRequiredMixin, django.views.generic.base.View

Lets the user choose which email to subscribe to a package with. This is an alternative view when JS is disabled and the appropriate choice cannot be offered in a popup.

template_name = 'accounts/choose-email.html'
get(request)[source]
class distro_tracker.accounts.views.ModifyKeywordsView(**kwargs)[source]

Bases: django_email_accounts.views.LoginRequiredMixin, django.views.generic.base.View

Lets the logged-in user modify their default keywords or subscription-specific keywords.

get_keywords(keywords)[source]
Returns

Keyword instances for the given keyword names.

modify_default_keywords(email, keywords)[source]
modify_subscription_keywords(email, package, keywords)[source]
render_response()[source]
post(request)[source]
get(request)[source]

distro_tracker.accounts.hooks

Functions that Distro-Tracker hooks into django_email_accounts.

distro_tracker.accounts.hooks.post_merge(initial_user, merge_with)[source]

When two user accounts are joined by django_email_accounts, move the teams owned by the account to be deleted to the new merged account.