new field finance_id
This commit is contained in:
parent
e4c8967a07
commit
6fdd04306f
3 changed files with 23 additions and 5 deletions
18
input/migrations/0066_project_finance_id.py
Normal file
18
input/migrations/0066_project_finance_id.py
Normal file
|
@ -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),
|
||||||
|
),
|
||||||
|
]
|
|
@ -39,9 +39,9 @@ class Extern(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?
|
||||||
super().save(*args,*kwargs)
|
super().save(*args,**kwargs)
|
||||||
self.service_id = type(self).__name__ + str(self.pk)
|
self.service_id = type(self).__name__ + str(self.pk)
|
||||||
super().save(*args,*kwargs)
|
super().save(*args,**kwargs)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
abstract = True
|
abstract = True
|
||||||
|
@ -84,7 +84,7 @@ class Project(Volunteer):
|
||||||
end_mail_send = models.BooleanField(null=True)
|
end_mail_send = models.BooleanField(null=True)
|
||||||
status = models.CharField(max_length=3,choices=(('RUN', 'läuft'),('END','beendet')),default='RUN')
|
status = models.CharField(max_length=3,choices=(('RUN', 'läuft'),('END','beendet')),default='RUN')
|
||||||
persons = models.IntegerField(default=1)
|
persons = models.IntegerField(default=1)
|
||||||
|
finance_id = models.CharField(max_length=15, null= True, blank=True)
|
||||||
|
|
||||||
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?
|
||||||
|
|
|
@ -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(f'pid: {obj.pid}')
|
print(f'pid: {obj.finance_id}')
|
||||||
self.assertEqual(obj.pid,'1234000')
|
self.assertEqual(obj.finance_id,'1234000')
|
||||||
|
|
Loading…
Reference in a new issue