Browse Source

pid test working (and failing - as it should)

master
Benni Baermann 3 years ago
parent
commit
e4c8967a07
2 changed files with 4 additions and 4 deletions
  1. +2
    -2
      input/models.py
  2. +2
    -2
      input/tests.py

+ 2
- 2
input/models.py View File

@ -89,9 +89,9 @@ class Project(Volunteer):
def save(self,*args,**kwargs): def save(self,*args,**kwargs):
# is there a way to call super().save() only once? # is there a way to call super().save() only once?
print(f'1: {self.id}') print(f'1: {self.id}')
#super().save(*args,**kwargs)
# super().save(*args,**kwargs)
print(f'2: {self.id}') print(f'2: {self.id}')
self.pid = str(self.account) + str(self.pk).zfill(3)
self.pid = str(self.account.code) + str(self.pk).zfill(3)
print(f'3: {self.id}') print(f'3: {self.id}')
super().save(*args,**kwargs) super().save(*args,**kwargs)

+ 2
- 2
input/tests.py View File

@ -50,5 +50,5 @@ class TestWithLogin(TestCase):
#acc.save() #acc.save()
obj = Project.objects.create(account= acc, name='testproject', start='2022-01-01') obj = Project.objects.create(account= acc, name='testproject', start='2022-01-01')
#obj.save() #obj.save()
print(obj.pid)
self.assertEqual(True,True)
print(f'pid: {obj.pid}')
self.assertEqual(obj.pid,'1234000')

Loading…
Cancel
Save