fixed literature selfbuy variables in admin view
This commit is contained in:
parent
b5062dcc28
commit
2cd2d9f110
4 changed files with 4 additions and 5 deletions
|
@ -53,8 +53,6 @@ class LiteratureAdmin(admin.ModelAdmin):
|
|||
list_display = ('realname', 'service_id', 'granted', 'granted_date')
|
||||
list_display_links = ('realname', 'service_id')
|
||||
date_hierarchy = 'granted_date'
|
||||
class Media:
|
||||
js = ('dropdown/js/base.js',)
|
||||
|
||||
|
||||
@admin.register(Account)
|
||||
|
|
|
@ -111,7 +111,7 @@ class CheckForm(FdbForm):
|
|||
class LiteratureForm(CheckForm):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.fields['selfbuy_give_data'].required = True
|
||||
self.fields['selfbuy_give_data'].required = False
|
||||
class Meta:
|
||||
model = Literature
|
||||
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.")
|
||||
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_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>\
|
||||
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."))
|
||||
|
|
|
@ -210,10 +210,11 @@ class ExternView(CookieWizardView):
|
|||
data = {}
|
||||
for form in form_list:
|
||||
data = {**data, **form.cleaned_data}
|
||||
|
||||
if data['choice'] == 'LIT':
|
||||
if data['selfbuy'] == 'TRUE':
|
||||
data['selfbuy_give_data'] = 'False'
|
||||
|
||||
|
||||
# write data to database
|
||||
modell = form.save(commit=False)
|
||||
# we have to copy the data from the first form here
|
||||
|
|
Loading…
Reference in a new issue