forked from beba/foerderbarometer
fixed literature selfbuy variables in admin view
This commit is contained in:
parent
1d9811b0ff
commit
94f82d5733
|
@ -53,8 +53,6 @@ class LiteratureAdmin(admin.ModelAdmin):
|
||||||
list_display = ('realname', 'service_id', 'granted', 'granted_date')
|
list_display = ('realname', 'service_id', 'granted', 'granted_date')
|
||||||
list_display_links = ('realname', 'service_id')
|
list_display_links = ('realname', 'service_id')
|
||||||
date_hierarchy = 'granted_date'
|
date_hierarchy = 'granted_date'
|
||||||
class Media:
|
|
||||||
js = ('dropdown/js/base.js',)
|
|
||||||
|
|
||||||
|
|
||||||
@admin.register(Account)
|
@admin.register(Account)
|
||||||
|
|
|
@ -111,7 +111,7 @@ class CheckForm(FdbForm):
|
||||||
class LiteratureForm(CheckForm):
|
class LiteratureForm(CheckForm):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.fields['selfbuy_give_data'].required = True
|
self.fields['selfbuy_give_data'].required = False
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Literature
|
model = Literature
|
||||||
fields = ['cost', 'info', 'source', 'notes', 'selfbuy', 'selfbuy_data', 'selfbuy_give_data']
|
fields = ['cost', 'info', 'source', 'notes', 'selfbuy', 'selfbuy_data', 'selfbuy_give_data']
|
||||||
|
|
|
@ -264,7 +264,7 @@ class Literature(Grant):
|
||||||
help_text="Bitte gib an, wo du das Werk kaufen möchtest.")
|
help_text="Bitte gib an, wo du das Werk kaufen möchtest.")
|
||||||
selfbuy = models.CharField( max_length=10, verbose_name='Selbstkauf?', choices=SELFBUY_CHOICES.items(), default='TRUE')
|
selfbuy = models.CharField( max_length=10, verbose_name='Selbstkauf?', choices=SELFBUY_CHOICES.items(), default='TRUE')
|
||||||
selfbuy_give_data = models.BooleanField(verbose_name=format_html('Datenweitergabe erlauben'), help_text=format_html('Ich stimme der Weitergabe meiner Daten (Name, Postadresse) an den von mir angegebenen Anbieter/Dienstleister zu.'))
|
selfbuy_give_data = models.BooleanField(verbose_name=format_html('Datenweitergabe erlauben'), help_text=format_html('Ich stimme der Weitergabe meiner Daten (Name, Postadresse) an den von mir angegebenen Anbieter/Dienstleister zu.'))
|
||||||
selfbuy_data = models.TextField(max_length=1000, verbose_name='Persönliche Daten sowie Adresse', default='',
|
selfbuy_data = models.TextField(max_length=1000, verbose_name='Persönliche Daten sowie Adresse', default='',\
|
||||||
help_text=format_html("Bitte gib hier alle persönlichen Daten an, die wir benötigen, um das Werk<br>\
|
help_text=format_html("Bitte gib hier alle persönlichen Daten an, die wir benötigen, um das Werk<br>\
|
||||||
für dich zu kaufen und es dir anschließend zu schicken (z.B. Vorname Nachname, Anschrift, <br>\
|
für dich zu kaufen und es dir anschließend zu schicken (z.B. Vorname Nachname, Anschrift, <br>\
|
||||||
Telefonnummer, E-Mail-Adresse usw.). Trenne die einzelnen Angaben durch Zeilenumbrüche."))
|
Telefonnummer, E-Mail-Adresse usw.). Trenne die einzelnen Angaben durch Zeilenumbrüche."))
|
||||||
|
|
|
@ -210,10 +210,11 @@ class ExternView(CookieWizardView):
|
||||||
data = {}
|
data = {}
|
||||||
for form in form_list:
|
for form in form_list:
|
||||||
data = {**data, **form.cleaned_data}
|
data = {**data, **form.cleaned_data}
|
||||||
|
|
||||||
if data['choice'] == 'LIT':
|
if data['choice'] == 'LIT':
|
||||||
if data['selfbuy'] == 'TRUE':
|
if data['selfbuy'] == 'TRUE':
|
||||||
data['selfbuy_give_data'] = 'False'
|
data['selfbuy_give_data'] = 'False'
|
||||||
|
|
||||||
# write data to database
|
# write data to database
|
||||||
modell = form.save(commit=False)
|
modell = form.save(commit=False)
|
||||||
# we have to copy the data from the first form here
|
# we have to copy the data from the first form here
|
||||||
|
|
Loading…
Reference in New Issue