Models

class accounts.models.EmailActivation(id, token, created_at, user_id, email)[source]

Bases: app.shared.models.CreatedAtMixin, app.shared.models.SHA1TokenMixin

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception EmailActivation.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Get new email activation link

Returns:complete email change activation link
Return type:str
EmailActivation.get_next_by_created_at(*moreargs, **morekwargs)
EmailActivation.get_previous_by_created_at(*moreargs, **morekwargs)
EmailActivation.objects = <django.db.models.manager.Manager object>
EmailActivation.user
class accounts.models.PasswordReset(id, token, created_at, user_id)[source]

Bases: app.shared.models.CreatedAtMixin, app.shared.models.SHA1TokenMixin

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception PasswordReset.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

PasswordReset.get_next_by_created_at(*moreargs, **morekwargs)

Returns password reset link

Returns:complete password reset link
Return type:str
PasswordReset.get_previous_by_created_at(*moreargs, **morekwargs)
PasswordReset.objects = <django.db.models.manager.Manager object>
PasswordReset.user
class accounts.models.UserActivation(id, token, created_at, user_id)[source]

Bases: app.shared.models.CreatedAtMixin, app.shared.models.SHA1TokenMixin

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception UserActivation.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Returns user activation link

Returns:complete user activation link
Return type:str
UserActivation.get_next_by_created_at(*moreargs, **morekwargs)
UserActivation.get_previous_by_created_at(*moreargs, **morekwargs)
UserActivation.objects = <django.db.models.manager.Manager object>
UserActivation.user
class accounts.models.UserProfile(id, user_id, dob, sex, height)[source]

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception UserProfile.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

UserProfile.age
Returns:user age in years
Return type:int
UserProfile.bmi

Compute BMI for last weighting

Returns:tuple of user BMI and date of last weighting
Return type:tuple
UserProfile.favourite_sport
  1. get discipline with most workouts in last year
  2. If there is no workouts in last year - get from all workouts
Returns:favourite discipline object
UserProfile.favourite_sport_method(**extra_filters)[source]
  1. get discipline with most workouts in last year
  2. If there is no workouts in last year - get from all workouts
Parameters:extra_filters – extra sport queryset filters
Returns:favourite discipline object
UserProfile.favourite_sport_with_distance

Get favourite discipline with displayable distance.

  1. get discipline with most workouts in last year
  2. If there is no workouts in last year - get from all workouts
Returns:favourite discipline with displayable distance object
UserProfile.get_sex_display(*moreargs, **morekwargs)
UserProfile.get_sports_in_year(year=None)[source]

Returns list of sports from workouts in given calendar year sorted by workouts number.

If year is not given use current year.

Parameters:year – int, year
Returns:sports from given year workouts
Return type:list
UserProfile.last_weight

Get last user weight

Returns:tuple of last weight and date of last weighting or None
Return type:tuple
UserProfile.objects = <django.db.models.manager.Manager object>
UserProfile.sex_visible
Returns:user sex for template
Return type:str
UserProfile.user
accounts.models.on_user_create(sender, instance, created, **kwargs)[source]