Models
Club
¶
Bases: Model
The Club class, made as a tree to allow nice tidy organization.
check_loop()
¶
Raise a validation error when a loop is found within the parent list.
Source code in club/models.py
is_owned_by(user)
¶
can_be_edited_by(user)
¶
can_be_viewed_by(user)
¶
Method to see if that object can be seen by the given user.
get_membership_for(user)
¶
Return the current membership the given user.
Note
The result is cached.
Source code in club/models.py
MembershipQuerySet
¶
Bases: QuerySet
ongoing()
¶
board()
¶
Filter all memberships where the user is/was in the board.
Be aware that users who were in the board in the past are included, even if there are no more members.
If you want to get the users who are currently in the board,
mind combining this with the :meth:ongoing
queryset method
Source code in club/models.py
update(**kwargs)
¶
Refresh the cache for the elements of the queryset.
Besides that, does the same job as a regular update method.
Be aware that this adds a db query to retrieve the updated objects
Source code in club/models.py
delete()
¶
Work just like the default Django's delete() method, but add a cache invalidation for the elements of the queryset before the deletion.
Be aware that this adds a db query to retrieve the deleted element. As this first query take place before the deletion operation, it will be performed even if the deletion fails.
Source code in club/models.py
Membership
¶
Bases: Model
The Membership class makes the connection between User and Clubs.
Both Users and Clubs can have many Membership objects
- a user can be a member of many clubs at a time
- a club can have many members at a time too
A User is currently member of all the Clubs where its Membership has an end_date set to null/None. Otherwise, it's a past membership kept because it can be very useful to see who was in which Club in the past.
Mailing
¶
Bases: Model
A Mailing list for a club.
Warning
Remember that mailing lists should be validated by UTBM.
MailingSubscription
¶
Bases: Model
Link between user and mailing list.