Skip to content
Snippets Groups Projects
Verified Commit 0a6f4e5f authored by Tom Teichler's avatar Tom Teichler :beers:
Browse files

Add member information fields. Advances #86

parent 3ff2046d
No related branches found
No related tags found
1 merge request!55WIP: Resolve "Migrate to AlekSIS app"
from jsonstore import CharField
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from jsonstore import CharField, IntegerField, DateField
from aleksis.core.models import Person
from aleksis.core.models import Person, Group
@Person.property
def is_member_of(self, group):
""" Check if person is member of a given group """
return group in self.groups
@Person.property
def is_member(self):
""" Check if person is still a member """
now = timezone.datetime.now().date()
members = Groups.objects.get(short_name="members")
return (
self.is_member_of(members)
and (self.member_since and self.member_since <= now)
and (not self.member_until or self.member_until >= now)
)
# Field for school
Person.field(school=CharField(verbose_name=_("Name of school")))
Person.field(school_class=CharField(verbose_name=_("School class")))
Person.field(school_place=CharField(verbose_name=_("Place of the school")))
# Member information
Person.field(
employee_number=IntegerField(
verbose_name=_("Employee number"), blank=True, null=True
)
)
Person.field(
member_since=DateField(verbose_name=_("Member since"), blank=True, null=True)
)
Person.field(
member_until=DateField(verbose_name=_("Member until"), blank=True, null=True)
)
Person.field(iban=CharField(verbose_name=_("IBAN"), blank=True, null=True))
Person.field(bic=CharField(verbose_name=_("BIC"), blank=True, null=True))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment