Browse Source

new field finance_id

master
Benni Bärmann 1 year ago
parent
commit
6fdd04306f
  1. 18
      input/migrations/0066_project_finance_id.py
  2. 6
      input/models.py
  3. 4
      input/tests.py

18
input/migrations/0066_project_finance_id.py

@ -0,0 +1,18 @@
# Generated by Django 3.2.5 on 2021-10-04 08:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('input', '0065_rename_accounts_account'),
]
operations = [
migrations.AddField(
model_name='project',
name='finance_id',
field=models.CharField(blank=True, max_length=15, null=True),
),
]

6
input/models.py

@ -39,9 +39,9 @@ class Extern(Volunteer):
def save(self,*args,**kwargs):
# is there a way to call super().save() only once?
super().save(*args,*kwargs)
super().save(*args,**kwargs)
self.service_id = type(self).__name__ + str(self.pk)
super().save(*args,*kwargs)
super().save(*args,**kwargs)
class Meta:
abstract = True
@ -84,7 +84,7 @@ class Project(Volunteer):
end_mail_send = models.BooleanField(null=True)
status = models.CharField(max_length=3,choices=(('RUN', 'läuft'),('END','beendet')),default='RUN')
persons = models.IntegerField(default=1)
finance_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?

4
input/tests.py

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