Browse Source

projects_of_year test expanded, fails now (as expected)

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

+ 6
- 0
input/models.py View File

@ -98,6 +98,12 @@ class Project(Volunteer):
# self.finance_id = "1234000"
year = self.start.year
print(f"startyear: {year}")
projects = Project.objects.filter(start__year=year)
print(projects)
if not projects:
self.project_of_year = 1
else:
pass
else:
print(f"project_of_year is {self.project_of_year}")
super().save(*args,**kwargs)

+ 3
- 0
input/tests.py View File

@ -54,3 +54,6 @@ class TestWithLogin(TestCase):
#obj.save()
print(f'pid: {obj.project_of_year}')
self.assertEqual(obj.project_of_year,1)
obj2 = Project.objects.create(account= acc, name='testproject2', start=startdate)
self.assertEqual(obj.project_of_year,2)

Loading…
Cancel
Save