eggplant.profiles package

Submodules

eggplant.profiles.admin module

class eggplant.profiles.admin.UserProfileAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

media

eggplant.profiles.forms module

class eggplant.profiles.forms.NewUserSetPasswordForm(*args, **kwargs)[source]

Bases: allauth.account.forms.SetPasswordForm

base_fields = OrderedDict([('password1', <allauth.account.forms.SetPasswordField object>), ('password2', <allauth.account.forms.PasswordField object>)])
declared_fields = OrderedDict([('password1', <allauth.account.forms.SetPasswordField object>), ('password2', <allauth.account.forms.PasswordField object>)])
media
save(*args, **kwargs)[source]
class eggplant.profiles.forms.ProfileForm(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]

Bases: django.forms.forms.Form

base_fields = OrderedDict([('first_name', <django.forms.fields.CharField object>), ('middle_name', <django.forms.fields.CharField object>), ('last_name', <django.forms.fields.CharField object>), ('address', <django.forms.fields.CharField object>), ('city', <django.forms.fields.CharField object>), ('postcode', <django.forms.fields.CharField object>), ('tel', <django.forms.fields.CharField object>), ('sex', <django.forms.fields.ChoiceField object>), ('photo', <django.forms.fields.ImageField object>)])
declared_fields = OrderedDict([('first_name', <django.forms.fields.CharField object>), ('middle_name', <django.forms.fields.CharField object>), ('last_name', <django.forms.fields.CharField object>), ('address', <django.forms.fields.CharField object>), ('city', <django.forms.fields.CharField object>), ('postcode', <django.forms.fields.CharField object>), ('tel', <django.forms.fields.CharField object>), ('sex', <django.forms.fields.ChoiceField object>), ('photo', <django.forms.fields.ImageField object>)])
media
class eggplant.profiles.forms.SignupForm(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]

Bases: eggplant.profiles.forms.ProfileForm

base_fields = OrderedDict([('first_name', <django.forms.fields.CharField object>), ('middle_name', <django.forms.fields.CharField object>), ('last_name', <django.forms.fields.CharField object>), ('address', <django.forms.fields.CharField object>), ('city', <django.forms.fields.CharField object>), ('postcode', <django.forms.fields.CharField object>), ('tel', <django.forms.fields.CharField object>), ('sex', <django.forms.fields.ChoiceField object>), ('photo', <django.forms.fields.ImageField object>), ('email', <django.forms.fields.EmailField object>), ('password1', <allauth.account.forms.SetPasswordField object>), ('password2', <allauth.account.forms.PasswordField object>)])
clean_email()[source]

Check if user is already registered and if so raise validation error.

It may be considered a security hole to inform if a user is registered or not but it improves usability.

declared_fields = OrderedDict([('first_name', <django.forms.fields.CharField object>), ('middle_name', <django.forms.fields.CharField object>), ('last_name', <django.forms.fields.CharField object>), ('address', <django.forms.fields.CharField object>), ('city', <django.forms.fields.CharField object>), ('postcode', <django.forms.fields.CharField object>), ('tel', <django.forms.fields.CharField object>), ('sex', <django.forms.fields.ChoiceField object>), ('photo', <django.forms.fields.ImageField object>), ('email', <django.forms.fields.EmailField object>), ('password1', <allauth.account.forms.SetPasswordField object>), ('password2', <allauth.account.forms.PasswordField object>)])
media

eggplant.profiles.middleware module

class eggplant.profiles.middleware.NewUserForceProfileMiddleware[source]

Bases: object

process_request(request)[source]

eggplant.profiles.models module

class eggplant.profiles.models.UserProfile(id, user, middle_name, address, postcode, city, tel, tel2, sex, photo, created, changed)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

FEMALE = 'female'
MALE = 'male'
exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

OTHER = 'other'
SEX_CHOICES = (('', '-----'), ('female', 'female'), ('male', 'male'), ('other', 'other'))
accounts

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.

active_accounts()[source]

Returns the active accounts.

address

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

administrator_for

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.

can_be_edited_by(user_profile)[source]
changed

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

city

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

created

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

full_name

Returns member’s full name.

get_next_by_changed(*moreargs, **morekwargs)
get_next_by_created(*moreargs, **morekwargs)
get_previous_by_changed(*moreargs, **morekwargs)
get_previous_by_created(*moreargs, **morekwargs)
get_sex_display(*moreargs, **morekwargs)
has_admin_permission(department)[source]
id

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

classmethod in_department(department, only_active_accounts=True)[source]

Returns the user profiles linked to the given department via: UserProfile -> Account -> DepartmentMembership -> Department

is_complete()[source]
middle_name

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>
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.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.

photo

Just like the FileDescriptor, but for ImageFields. The only difference is assigning the width/height to the width_field/height_field, if appropriate.

photo_url_or_default()[source]
postcode

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

sex

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

tel

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

tel2

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

user

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

user_id

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

userprofilepermission_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.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.

eggplant.profiles.models.create_user_profile(*args, **kwargs)[source]

Every time a user is created, we automatically create a profile for the user.

eggplant.profiles.tests module

eggplant.profiles.urls module

eggplant.profiles.views module

class eggplant.profiles.views.NewUserPassword(**kwargs)[source]

Bases: eggplant.core.views.LoginRequiredMixin, allauth.account.views.PasswordSetView

Set password only for a new user. Existing users can use password change.

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

Overrides PasswordSetView.dispatch with the View.dispatch

form_class

alias of NewUserSetPasswordForm

form_valid(form)[source]
get(request, *args, **kwargs)[source]
get_authenticated_redirect_url(*args, **kwargs)[source]
get_success_url(*args, **kwargs)[source]
post(request, *args, **kwargs)[source]
success_url = <django.utils.functional.__proxy__ object>
class eggplant.profiles.views.Profile(**kwargs)[source]

Bases: eggplant.core.views.LoginRequiredMixin, django.views.generic.edit.FormView

Profile form view.

form_class

alias of ProfileForm

form_valid(form)[source]
get_initial()[source]
get_object(queryset=None)[source]
success_url = <django.utils.functional.__proxy__ object>
template_name = 'eggplant/profiles/profile_detail.html'
eggplant.profiles.views.signup(request)[source]

Module contents