Accounts App¶
The accounts application extends the default Django authentication
and Django registration redux
in order to support IMAGE-InjectTool two-steps authentication with Biosample registration
and tracking uid.models.Organization objects.
accounts.forms¶
accounts.forms module contents¶
Created on Thu Jun 21 16:04:02 2018
@author: Paolo Cozzi <cozzi@ibba.cnr.it>
inspired from A Complete Beginner’s Guide to Django - Part 4
-
class
accounts.forms.MyAccountForm(*args, **kwargs)[source]¶ Bases:
common.forms.RequestFormMixin,betterforms.multiform.MultiModelForm-
form_classes= {'person': <class 'accounts.forms.PersonForm'>, 'user': <class 'accounts.forms.UserForm'>}¶
-
-
class
accounts.forms.PersonForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]¶ Bases:
django.forms.models.ModelForm-
class
Meta[source]¶ Bases:
object-
fields= ('initials', 'affiliation', 'role')¶
-
model¶ alias of
uid.models.Person
-
-
base_fields= {'affiliation': <django.forms.models.ModelChoiceField object>, 'initials': <django.forms.fields.CharField object>, 'role': <django.forms.models.ModelChoiceField object>}¶
-
declared_fields= {}¶
-
property
media¶ Return all media required to render the widgets on this form.
-
class
-
class
accounts.forms.SignUpForm(*args, **kwargs)[source]¶ Bases:
common.forms.RequestFormMixin,betterforms.multiform.MultiModelForm-
form_classes= {'person': <class 'accounts.forms.SignUpPersonForm'>, 'user': <class 'accounts.forms.SignUpUserForm'>}¶
-
-
class
accounts.forms.SignUpPersonForm(*args, **kwargs)[source]¶ Bases:
django.forms.models.ModelForm-
class
Meta[source]¶ Bases:
object-
fields= ('initials', 'affiliation', 'role')¶
-
model¶ alias of
uid.models.Person
-
-
base_fields= {'affiliation': <django.forms.models.ModelChoiceField object>, 'agree_gdpr': <django.forms.fields.BooleanField object>, 'botcatcher': <django.forms.fields.CharField object>, 'initials': <django.forms.fields.CharField object>, 'role': <django.forms.models.ModelChoiceField object>}¶
-
declared_fields= {'agree_gdpr': <django.forms.fields.BooleanField object>, 'botcatcher': <django.forms.fields.CharField object>}¶
-
property
media¶ Return all media required to render the widgets on this form.
-
class
-
class
accounts.forms.SignUpUserForm(*args, **kwargs)[source]¶ Bases:
django.contrib.auth.forms.UserCreationForm-
class
Meta[source]¶ Bases:
object-
fields= ('username', 'first_name', 'last_name', 'email', 'password1', 'password2')¶
-
model¶ alias of
django.contrib.auth.models.User
-
-
base_fields= {'email': <django.forms.fields.CharField object>, 'first_name': <django.forms.fields.CharField object>, 'last_name': <django.forms.fields.CharField object>, 'password1': <django.forms.fields.CharField object>, 'password2': <django.forms.fields.CharField object>, 'username': <django.forms.fields.CharField object>}¶
-
declared_fields= {'email': <django.forms.fields.CharField object>, 'first_name': <django.forms.fields.CharField object>, 'last_name': <django.forms.fields.CharField object>, 'password1': <django.forms.fields.CharField object>, 'password2': <django.forms.fields.CharField object>}¶
-
property
media¶ Return all media required to render the widgets on this form.
-
class
-
class
accounts.forms.UserForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]¶ Bases:
django.forms.models.ModelForm-
class
Meta[source]¶ Bases:
object-
fields= ('first_name', 'last_name', 'email')¶
-
model¶ alias of
django.contrib.auth.models.User
-
-
base_fields= {'email': <django.forms.fields.CharField object>, 'first_name': <django.forms.fields.CharField object>, 'last_name': <django.forms.fields.CharField object>}¶
-
declared_fields= {'email': <django.forms.fields.CharField object>, 'first_name': <django.forms.fields.CharField object>, 'last_name': <django.forms.fields.CharField object>}¶
-
property
media¶ Return all media required to render the widgets on this form.
-
class
accounts.models¶
accounts.models module contents¶
Created on Fri Jul 20 13:35:27 2018
@author: Paolo Cozzi <cozzi@ibba.cnr.it>
-
class
accounts.models.MyRegistrationManager(*args, **kwargs)[source]¶ Bases:
registration.models.RegistrationManager
-
class
accounts.models.MyRegistrationProfile(id, user, activation_key, activated)[source]¶ Bases:
registration.models.RegistrationProfile-
exception
DoesNotExist¶ Bases:
registration.models.RegistrationProfile.DoesNotExist
-
exception
MultipleObjectsReturned¶ Bases:
registration.models.RegistrationProfile.MultipleObjectsReturned
-
create_new_activation_key(save=True)[source]¶ Create a new activation key for the user. If the old one is still valid return it
-
objects= <accounts.models.MyRegistrationManager object>¶
-
exception
accounts.views¶
accounts.views module contents¶
Created on Thu Jun 21 16:04:02 2018
@author: Paolo Cozzi <cozzi@ibba.cnr.it>
inspired from A Complete Beginner’s Guide to Django - Part 4
-
class
accounts.views.ActivationComplete(**kwargs)[source]¶ Bases:
django.contrib.auth.mixins.LoginRequiredMixin,django.views.generic.base.TemplateView-
template_name= 'registration/activation_complete.html'¶
-
-
class
accounts.views.ActivationView(**kwargs)[source]¶ Bases:
registration.backends.default.views.ActivationView-
activate(*args, **kwargs)[source]¶ Given an an activation key, look up and activate the user account corresponding to that key (if possible).
After successful activation, the signal
registration.signals.user_activatedwill be sent, with the newly activatedUseras the keyword argumentuserand the class of this backend as the sender.
-
success_url= 'accounts:registration_activation_complete'¶
-
template_name= 'registration/activation_failed.html'¶
-
-
class
accounts.views.MyAccountView(**kwargs)[source]¶ Bases:
django.contrib.auth.mixins.LoginRequiredMixin,django.views.generic.edit.UpdateView-
form_class¶ alias of
accounts.forms.MyAccountForm
-
get_object()[source]¶ Return the object the view is displaying.
Require self.queryset and a pk or slug argument in the URLconf. Subclasses can override this to return any object.
-
model¶ alias of
django.contrib.auth.models.User
-
success_url¶
-
template_name= 'accounts/update_user.html'¶
-
-
class
accounts.views.ResendActivationView(**kwargs)[source]¶ Bases:
registration.backends.default.views.ResendActivationView-
form_valid(form)[source]¶ Regardless if resend_activation is successful, display the same confirmation template.
-
registration_profile¶
-
-
class
accounts.views.SignUpView(**kwargs)[source]¶ Bases:
registration.backends.default.views.RegistrationView-
form_class¶ alias of
accounts.forms.SignUpForm
-
register(form)[source]¶ Given a username, email address and password, register a new user account, which will initially be inactive. Along with the new
Userobject, a newregistration.models.RegistrationProfilewill be created, tied to thatUser, containing the activation key which will be used for this account. An email will be sent to the supplied email address; this email should contain an activation link. The email will be rendered using two templates. See the documentation forRegistrationProfile.send_activation_email()for information about these templates and the contexts provided to them. After theUserandRegistrationProfileare created and the activation email is sent, the signalregistration.signals.user_registeredwill be sent, with the newUseras the keyword argumentuserand the class of this backend as the sender.
-
success_url= 'accounts:registration_complete'¶
-
template_name= 'accounts/signup.html'¶
-