Browse Source

service id added

master
Benni Baermann 4 years ago
parent
commit
9ef3f27502
3 changed files with 58 additions and 3 deletions
  1. +5
    -3
      input/forms.py
  2. +43
    -0
      input/migrations/0033_auto_20201029_1338.py
  3. +10
    -0
      input/models.py

+ 5
- 3
input/forms.py View File

@ -31,7 +31,7 @@ class ExternForm(ModelForm):
class Meta: class Meta:
model = Extern model = Extern
exclude = ('granted', 'granted_date', 'survey_mail_send')
exclude = ('granted', 'granted_date', 'survey_mail_send', 'service_id')
INTERN_CHOICES = {'PRO': 'Projektsteckbrief', INTERN_CHOICES = {'PRO': 'Projektsteckbrief',
'HON': 'Ehrenamtsbescheinigung, Akkreditierung oder Redaktionsbestätigung', 'HON': 'Ehrenamtsbescheinigung, Akkreditierung oder Redaktionsbestätigung',
@ -55,12 +55,14 @@ class LibraryForm(ModelForm):
class Meta: class Meta:
model = Library 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 IFGForm(ModelForm):
class Meta: class Meta:
model = IFG 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 HonoraryCertificateForm(ModelForm):
class Meta: class Meta:

+ 43
- 0
input/migrations/0033_auto_20201029_1338.py 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),
),
]

+ 10
- 0
input/models.py View File

@ -30,6 +30,16 @@ class Extern(Volunteer):
''' abstract basis class for all data entered by extern volunteers ''' ''' abstract basis class for all data entered by extern volunteers '''
username = models.CharField(max_length=200, null=True) 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: class Meta:
abstract = True abstract = True

Loading…
Cancel
Save