more for generating keys (broken version)

This commit is contained in:
Benni Bärmann 2020-10-06 15:15:05 +02:00
parent 23b28e0406
commit 3ff7cd66b0
1 changed files with 10 additions and 10 deletions

View File

@ -14,17 +14,17 @@ class Project(Volunteer):
start = models.DateTimeField('start date') start = models.DateTimeField('start date')
# contact = models.ForeignKey(Volonteer, on_delete = models.CASCADE, null = True) # contact = models.ForeignKey(Volonteer, on_delete = models.CASCADE, null = True)
# pid = models.IntegerField(null=True) # automaticly generated pid = models.IntegerField(null=True) # automaticly generated
@property # @property
def pid(self): # def pid(self):
pid = "hurzel " + self.get_pk # pid = "hurzel " + self.get_pk
print(pid) # print(pid)
return pid # return pid
def save(self,*args,**kwargs):
self.pid = 10000 + self.pk
super().save(*args,*kwargs)
# def save(self,*args,**kwargs):
# self.pid =
# super().save(*args,*kwargs)
#
def __str__(self): def __str__(self):
return self.name return self.name