Add associate membership model fields

This commit is contained in:
Yingtong Li 2019-06-19 16:04:00 +10:00
parent 664a31500f
commit 1e3ff7475a
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
3 changed files with 12 additions and 0 deletions

View File

@ -32,6 +32,10 @@
<label class="three wide column">Member number</label> <label class="three wide column">Member number</label>
<div class="nine wide column">{{ member.id }}</div> <div class="nine wide column">{{ member.id }}</div>
</div> </div>
<div class="ui disabled inline grid field">
<label class="three wide column">Membership type</label>
<div class="nine wide column">{{ member.get_member_type_display() }}</div>
</div>
<div class="ui divider"></div> <div class="ui divider"></div>
<div class="ui required inline grid field"> <div class="ui required inline grid field">
<label class="three wide column">Student ID</label> <label class="three wide column">Student ID</label>

View File

@ -42,6 +42,13 @@ class Member(models.Model):
phone = models.CharField(max_length=20) phone = models.CharField(max_length=20)
MEMBER_TYPES = (
(1, 'Ordinary Member'),
(2, 'Associate Member'),
(3, 'Honorary Life Member'),
)
member_type = models.IntegerField(choices=MEMBER_TYPES)
expires = models.DateField() expires = models.DateField()
class Meta: class Meta:

View File

@ -53,6 +53,7 @@ def by_email(email):
member.year = {'Year A': 0, 'Year 1': 1, 'Year 2': 2, 'Year 3B': 3, 'Year 4C': 4, 'Year 5D': 5, 'BMedSci': 97, 'PhD': 98, 'Intermission': 99}[result[5]] member.year = {'Year A': 0, 'Year 1': 1, 'Year 2': 2, 'Year 3B': 3, 'Year 4C': 4, 'Year 5D': 5, 'BMedSci': 97, 'PhD': 98, 'Intermission': 99}[result[5]]
member.is_msa = result[6] member.is_msa = result[6]
member.phone = result[7] member.phone = result[7]
member.member_type = 1 # Ordinary Member
# Calculate expiration date # Calculate expiration date
member.expires = timezone.now().date().replace(month=3, day=31) member.expires = timezone.now().date().replace(month=3, day=31)