Browse Source

some documentation for clarification added

master
Benni Baermann 3 years ago
parent
commit
fd46dd2f5a
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      input/models.py

+ 6
- 1
input/models.py View File

@ -38,7 +38,8 @@ class Extern(Volunteer):
service_id = models.CharField(max_length=15, null=True, blank=True)
def save(self,*args,**kwargs):
# is there a way to call super().save() only once?
# we don't call save with args/kwargs to avoid UNIQUE CONSTRAINT errors
# but maybe there is a better solution?
super().save()
self.service_id = type(self).__name__ + str(self.pk)
super().save()
@ -89,9 +90,13 @@ class Project(Volunteer):
def save(self,*args,**kwargs):
'''we generate the autogenerated fields here'''
# we don't call save with args/kwargs to avoid UNIQUE CONSTRAINT errors
# but maybe there is a better solution?
super().save()
self.pid = str(self.account.code) + str(self.pk).zfill(3)
# generation of finance_id
if not self.project_of_year:
# we need to determine if this is a new year with its first new project...
year = self.start.year
projects = Project.objects.filter(start__year=year)
if not projects:

Loading…
Cancel
Save