From 6fdd04306f0ffc82385911243d1cc70e6ac199cb Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Mon, 4 Oct 2021 10:43:50 +0200 Subject: [PATCH] new field finance_id --- input/migrations/0066_project_finance_id.py | 18 ++++++++++++++++++ input/models.py | 6 +++--- input/tests.py | 4 ++-- 3 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 input/migrations/0066_project_finance_id.py diff --git a/input/migrations/0066_project_finance_id.py b/input/migrations/0066_project_finance_id.py new file mode 100644 index 0000000..9a9c82e --- /dev/null +++ b/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), + ), + ] diff --git a/input/models.py b/input/models.py index b3325d1..c4cec25 100644 --- a/input/models.py +++ b/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? diff --git a/input/tests.py b/input/tests.py index 9b5b708..3e643e2 100644 --- a/input/tests.py +++ b/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')