service id added

This commit is contained in:
Benni Bärmann 2020-10-29 15:05:11 +01:00
parent 71249aa73e
commit 9ef3f27502
3 changed files with 58 additions and 3 deletions

View File

@ -31,7 +31,7 @@ class ExternForm(ModelForm):
class Meta:
model = Extern
exclude = ('granted', 'granted_date', 'survey_mail_send')
exclude = ('granted', 'granted_date', 'survey_mail_send', 'service_id')
INTERN_CHOICES = {'PRO': 'Projektsteckbrief',
'HON': 'Ehrenamtsbescheinigung, Akkreditierung oder Redaktionsbestätigung',
@ -55,12 +55,14 @@ class LibraryForm(ModelForm):
class Meta:
model = Library
exclude = ('realname', 'email', 'username', 'type', 'granted', 'granted_date', 'survey_mail_send')
exclude = ('realname', 'email', 'username', 'type', 'granted',\
'granted_date', 'survey_mail_send', 'service_id')
class IFGForm(ModelForm):
class Meta:
model = IFG
exclude = ('realname', 'email', 'username', 'granted', 'granted_date', 'survey_mail_send')
exclude = ('realname', 'email', 'username', 'granted', 'granted_date',\
'service_id', 'survey_mail_send')
class HonoraryCertificateForm(ModelForm):
class Meta:

View File

@ -0,0 +1,43 @@
# Generated by Django 3.1.1 on 2020-10-29 13:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('input', '0032_auto_20201029_1213'),
]
operations = [
migrations.AddField(
model_name='businesscard',
name='service_id',
field=models.CharField(blank=True, max_length=15, null=True),
),
migrations.AddField(
model_name='email',
name='service_id',
field=models.CharField(blank=True, max_length=15, null=True),
),
migrations.AddField(
model_name='ifg',
name='service_id',
field=models.CharField(blank=True, max_length=15, null=True),
),
migrations.AddField(
model_name='library',
name='service_id',
field=models.CharField(blank=True, max_length=15, null=True),
),
migrations.AddField(
model_name='list',
name='service_id',
field=models.CharField(blank=True, max_length=15, null=True),
),
migrations.AddField(
model_name='literature',
name='service_id',
field=models.CharField(blank=True, max_length=15, null=True),
),
]

View File

@ -30,6 +30,16 @@ class Extern(Volunteer):
''' abstract basis class for all data entered by extern volunteers '''
username = models.CharField(max_length=200, null=True)
# the following Fields are not supposed to be edited by users
service_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?
super().save(*args,*kwargs)
print('******EXTERNSAVE********')
self.service_id = type(self).__name__ + str(self.pk)
super().save(*args,*kwargs)
class Meta:
abstract = True