From 37e629de708b77dade5bace365044717f28c52dd Mon Sep 17 00:00:00 2001 From: alpcentaur Date: Mon, 27 Feb 2023 17:09:29 +0000 Subject: [PATCH] rewrote the javascript part --- input/admin.py | 9 +- input/forms.py | 34 ++-- input/logfile | 120 +++++++++++ input/migrations/0081_auto_20221204_1733.py | 213 ++++++++++++++++++++ input/migrations/0082_auto_20221204_1822.py | 23 +++ input/migrations/0083_auto_20221205_0946.py | 18 ++ input/models.py | 45 ++--- input/static/dropdown/js/base.js | 1 + input/static/dropdown/js/businessCard.js | 28 +++ input/static/dropdown/js/literature.js | 42 ++++ input/static/dropdown/js/mail.js | 35 ++++ input/views.py | 13 +- 12 files changed, 530 insertions(+), 51 deletions(-) create mode 100644 input/logfile create mode 100644 input/migrations/0081_auto_20221204_1733.py create mode 100644 input/migrations/0082_auto_20221204_1822.py create mode 100644 input/migrations/0083_auto_20221205_0946.py create mode 100644 input/static/dropdown/js/businessCard.js create mode 100644 input/static/dropdown/js/literature.js create mode 100644 input/static/dropdown/js/mail.js diff --git a/input/admin.py b/input/admin.py index 469bcf8..cce44e1 100755 --- a/input/admin.py +++ b/input/admin.py @@ -65,9 +65,8 @@ class AccountAdmin(admin.ModelAdmin): @admin.register(HonoraryCertificate) class HonoraryCertificateAdmin(admin.ModelAdmin): save_as = True - search_fields = ('realname', 'granted', 'granted_date', 'project') - list_display = ('realname', 'granted', 'granted_date', 'project') - list_display_links = ('realname', 'project') + search_fields = ['realname', 'granted'] + list_display = ('realname', 'granted','project') date_hierarchy = 'granted_date' @admin.register(Library) @@ -89,7 +88,7 @@ class IFGAdmin(admin.ModelAdmin): @admin.register(Travel) class TravelAdmin(admin.ModelAdmin): save_as = True - search_fields = ('realname', 'granted', 'granted_date', 'project') + search_fields = ['realname', 'granted_date'] list_display = ('realname', 'granted', 'granted_date', 'project') list_display_links = ('realname', 'project') date_hierarchy = 'granted_date' @@ -101,6 +100,8 @@ class EmailAdmin(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(List) diff --git a/input/forms.py b/input/forms.py index c8e6897..261da35 100755 --- a/input/forms.py +++ b/input/forms.py @@ -22,7 +22,7 @@ class ProjectForm(FdbForm): class Meta: model = Project exclude = ('pid', 'project_of_year', 'finance_id','granted', 'granted_date', 'realname', 'email',\ - 'end_mail_send', 'status', 'persons', 'survey_mail_date') + 'end_mail_send', 'status', 'persons', 'survey_mail_date', 'mail_state') widgets = {'start': AdminDateWidget(), 'end': AdminDateWidget(),} @@ -38,7 +38,7 @@ class ExternForm(FdbForm): class Meta: model = ConcreteExtern - exclude = ('granted', 'granted_date', 'survey_mail_send', 'service_id', 'survey_mail_date') + exclude = ('granted', 'granted_date', 'survey_mail_send', 'service_id', 'survey_mail_date', 'mail_state') INTERN_CHOICES = {'PRO': 'Projektsteckbrief', @@ -51,7 +51,7 @@ class InternForm(FdbForm): class Meta: model = ConcreteVolunteer - exclude = ('granted', 'granted_date', 'survey_mail_send', 'survey_mail_date') + exclude = ('granted', 'granted_date', 'survey_mail_send', 'survey_mail_date', 'mail_state') class TravelForm(FdbForm): @@ -69,19 +69,20 @@ class TravelForm(FdbForm): class Meta: model = Travel - exclude = ('granted', 'granted_date', 'survey_mail_send', 'realname', 'email', 'survey_mail_date', 'project', 'request_url', 'payed_for_hotel_by', 'payed_for_travel_by', 'intern_notes' ) + exclude = ('granted', 'granted_date', 'survey_mail_send', 'realname', 'email', 'survey_mail_date', 'project', 'request_url', 'payed_for_hotel_by', 'payed_for_travel_by', 'intern_notes', 'mail_state' ) widgets = {'checkin': AdminDateWidget(), 'checkout': AdminDateWidget(),} - fields = ['project_name', 'transport', 'travelcost', 'checkin', 'checkout', 'hotel', 'notes', 'mail_state'] + fields = ['project_name', 'transport', 'travelcost', 'checkin', 'checkout', 'hotel', 'notes'] class LibraryForm(FdbForm): class Meta: model = Library fields = ['cost', 'library', 'duration', 'notes', 'survey_mail_send'] - exclude = ['intern_notes'] + exclude = ['intern_notes', 'survey_mail_send', 'mail_state'] class HonoraryCertificateForm(FdbForm): + class Meta: model = HonoraryCertificate fields = ['request_url', 'project'] @@ -91,7 +92,7 @@ class IFGForm(FdbForm): class Meta: model = IFG fields = ['cost', 'url', 'notes'] - exclude = ['intern_notes'] + exclude = ['intern_notes', 'survey_mail_send', 'mail_state'] class CheckForm(FdbForm): @@ -108,9 +109,9 @@ class LiteratureForm(CheckForm): class Meta: model = Literature fields = ['cost', 'info', 'source', 'notes', 'selfbuy', 'selfbuy_data', 'selfbuy_give_data'] - exclude = ['intern_notes'] + exclude = ['intern_notes', 'survey_mail_send', 'mail_state'] class Media: - js = ('dropdown/js/base.js',) + js = ('dropdown/js/literature.js',) class EmailForm(CheckForm): @@ -118,15 +119,15 @@ class EmailForm(CheckForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['adult'].required = True - + self.fields['other'].required = True # TODO: add some javascript to show/hide other-field class Meta: model = Email fields = ['domain', 'address', 'other', 'adult'] - exclude = ['intern_notes'] + exclude = ['intern_notes', 'survey_mail_send', 'mail_state'] class Media: - js = ('dropdown/js/base.js',) + js = ('dropdown/js/mail.js',) @@ -135,18 +136,19 @@ class BusinessCardForm(CheckForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['url_of_pic'].required = True + self.fields['send_data_to_print'].required = True class Meta: model = BusinessCard - exclude = ['intern_notes'] - fields = ['project', 'data', 'variant', 'url_of_pic', 'sent_to', 'mail_state'] + exclude = ['intern_notes', 'survey_mail_send', 'mail_state'] + fields = ['project', 'data', 'variant', 'url_of_pic', 'send_data_to_print', 'sent_to'] class Media: - js = ('dropdown/js/base.js',) + js = ('dropdown/js/businessCard.js',) class ListForm(CheckForm): class Meta: model = List fields = ['domain', 'address'] - exclude = ['intern_notes'] + exclude = ['intern_notes', 'survey_mail_send','mail_state'] diff --git a/input/logfile b/input/logfile new file mode 100644 index 0000000..861f27e --- /dev/null +++ b/input/logfile @@ -0,0 +1,120 @@ +nohup: ignoring input +[2022-12-05 10:02:21 +0000] [12084] [DEBUG] Current configuration: + config: None + bind: ['0:8000'] + backlog: 2048 + workers: 1 + worker_class: sync + threads: 1 + worker_connections: 1000 + max_requests: 0 + max_requests_jitter: 0 + timeout: 30 + graceful_timeout: 30 + keepalive: 2 + limit_request_line: 4094 + limit_request_fields: 100 + limit_request_field_size: 8190 + reload: False + reload_engine: auto + reload_extra_files: [] + spew: False + check_config: False + preload_app: False + sendfile: None + reuse_port: False + chdir: /home/fdb/foerderbaro/foerderbarometer/input + daemon: False + raw_env: [] + pidfile: None + worker_tmp_dir: None + user: 1001 + group: 1001 + umask: 0 + initgroups: False + tmp_upload_dir: None + secure_scheme_headers: {'X-FORWARDED-PROTOCOL': 'ssl', 'X-FORWARDED-PROTO': 'https', 'X-FORWARDED-SSL': 'on'} + forwarded_allow_ips: ['*'] + accesslog: None + disable_redirect_access_to_syslog: False + access_log_format: %(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s" + errorlog: - + loglevel: debug + capture_output: False + logger_class: gunicorn.glogging.Logger + logconfig: None + logconfig_dict: {} + syslog_addr: udp://localhost:514 + syslog: False + syslog_prefix: None + syslog_facility: user + enable_stdio_inheritance: False + statsd_host: None + dogstatsd_tags: + statsd_prefix: + proc_name: None + default_proc_name: foerderbarometer.wsgi + pythonpath: None + paste: None + on_starting: + on_reload: + when_ready: + pre_fork: + post_fork: + post_worker_init: + worker_int: + worker_abort: + pre_exec: + pre_request: + post_request: + child_exit: + worker_exit: + nworkers_changed: + on_exit: + proxy_protocol: False + proxy_allow_ips: ['127.0.0.1'] + keyfile: None + certfile: None + ssl_version: 2 + cert_reqs: 0 + ca_certs: None + suppress_ragged_eofs: True + do_handshake_on_connect: False + ciphers: None + raw_paste_global_conf: [] + strip_header_spaces: False +[2022-12-05 10:02:21 +0000] [12084] [INFO] Starting gunicorn 20.0.4 +[2022-12-05 10:02:21 +0000] [12084] [DEBUG] Arbiter booted +[2022-12-05 10:02:21 +0000] [12084] [INFO] Listening at: http://0.0.0.0:8000 (12084) +[2022-12-05 10:02:21 +0000] [12084] [INFO] Using worker: sync +[2022-12-05 10:02:21 +0000] [12086] [INFO] Booting worker with pid: 12086 +[2022-12-05 10:02:21 +0000] [12084] [DEBUG] 1 workers +[2022-12-05 10:02:21 +0000] [12086] [ERROR] Exception in worker process +Traceback (most recent call last): + File "/home/fdb/foerderbaro/foerderbarometer/venv/lib/python3.8/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker + worker.init_process() + File "/home/fdb/foerderbaro/foerderbarometer/venv/lib/python3.8/site-packages/gunicorn/workers/base.py", line 119, in init_process + self.load_wsgi() + File "/home/fdb/foerderbaro/foerderbarometer/venv/lib/python3.8/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi + self.wsgi = self.app.wsgi() + File "/home/fdb/foerderbaro/foerderbarometer/venv/lib/python3.8/site-packages/gunicorn/app/base.py", line 67, in wsgi + self.callable = self.load() + File "/home/fdb/foerderbaro/foerderbarometer/venv/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 49, in load + return self.load_wsgiapp() + File "/home/fdb/foerderbaro/foerderbarometer/venv/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp + return util.import_app(self.app_uri) + File "/home/fdb/foerderbaro/foerderbarometer/venv/lib/python3.8/site-packages/gunicorn/util.py", line 358, in import_app + mod = importlib.import_module(module) + File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module + return _bootstrap._gcd_import(name[level:], package, level) + File "", line 1014, in _gcd_import + File "", line 991, in _find_and_load + File "", line 961, in _find_and_load_unlocked + File "", line 219, in _call_with_frames_removed + File "", line 1014, in _gcd_import + File "", line 991, in _find_and_load + File "", line 973, in _find_and_load_unlocked +ModuleNotFoundError: No module named 'foerderbarometer' +[2022-12-05 10:02:21 +0000] [12086] [INFO] Worker exiting (pid: 12086) +[2022-12-05 10:02:21 +0000] [12084] [INFO] Shutting down: Master +[2022-12-05 10:02:21 +0000] [12084] [INFO] Reason: Worker failed to boot. diff --git a/input/migrations/0081_auto_20221204_1733.py b/input/migrations/0081_auto_20221204_1733.py new file mode 100644 index 0000000..9be8454 --- /dev/null +++ b/input/migrations/0081_auto_20221204_1733.py @@ -0,0 +1,213 @@ +# Generated by Django 3.1.2 on 2022-12-04 17:33 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('input', '0080_auto_20221129_2323'), + ] + + operations = [ + migrations.AlterField( + model_name='account', + name='intern_notes', + field=models.TextField(blank=True, max_length=1000, verbose_name='interne Anmerkungen'), + ), + migrations.AlterField( + model_name='businesscard', + name='granted', + field=models.BooleanField(null=True, verbose_name='bewilligt'), + ), + migrations.AlterField( + model_name='businesscard', + name='granted_date', + field=models.DateField(null=True, verbose_name='bewilligt am'), + ), + migrations.AlterField( + model_name='businesscard', + name='intern_notes', + field=models.TextField(blank=True, max_length=1000, verbose_name='interne Anmerkungen'), + ), + migrations.AlterField( + model_name='businesscard', + name='send_data_to_print', + field=models.BooleanField(default=False, help_text='Hiermit erlaube ich die Weitergabe meiner Daten (Name, Postadresse) an den von Wikimedia
Deutschland ausgewählten Dienstleister (z. B. wir-machen-druck.de) zum Zwecke des direkten
Versands der Druckerzeugnisse an mich.', verbose_name='Datenweitergabe erlauben'), + ), + migrations.AlterField( + model_name='concreteextern', + name='granted', + field=models.BooleanField(null=True, verbose_name='bewilligt'), + ), + migrations.AlterField( + model_name='concreteextern', + name='granted_date', + field=models.DateField(null=True, verbose_name='bewilligt am'), + ), + migrations.AlterField( + model_name='concretevolunteer', + name='granted', + field=models.BooleanField(null=True, verbose_name='bewilligt'), + ), + migrations.AlterField( + model_name='concretevolunteer', + name='granted_date', + field=models.DateField(null=True, verbose_name='bewilligt am'), + ), + migrations.AlterField( + model_name='email', + name='granted', + field=models.BooleanField(null=True, verbose_name='bewilligt'), + ), + migrations.AlterField( + model_name='email', + name='granted_date', + field=models.DateField(null=True, verbose_name='bewilligt am'), + ), + migrations.AlterField( + model_name='email', + name='intern_notes', + field=models.TextField(blank=True, max_length=1000, verbose_name='interne Anmerkungen'), + ), + migrations.AlterField( + model_name='honorarycertificate', + name='granted', + field=models.BooleanField(null=True, verbose_name='bewilligt'), + ), + migrations.AlterField( + model_name='honorarycertificate', + name='granted_date', + field=models.DateField(null=True, verbose_name='bewilligt am'), + ), + migrations.AlterField( + model_name='honorarycertificate', + name='intern_notes', + field=models.TextField(blank=True, max_length=1000, verbose_name='interne Anmerkungen'), + ), + migrations.AlterField( + model_name='ifg', + name='granted', + field=models.BooleanField(null=True, verbose_name='bewilligt'), + ), + migrations.AlterField( + model_name='ifg', + name='granted_date', + field=models.DateField(null=True, verbose_name='bewilligt am'), + ), + migrations.AlterField( + model_name='ifg', + name='intern_notes', + field=models.TextField(blank=True, max_length=1000, verbose_name='interne Anmerkungen'), + ), + migrations.AlterField( + model_name='library', + name='granted', + field=models.BooleanField(null=True, verbose_name='bewilligt'), + ), + migrations.AlterField( + model_name='library', + name='granted_date', + field=models.DateField(null=True, verbose_name='bewilligt am'), + ), + migrations.AlterField( + model_name='library', + name='intern_notes', + field=models.TextField(blank=True, max_length=1000, verbose_name='interne Anmerkungen'), + ), + migrations.AlterField( + model_name='library', + name='type', + field=models.CharField(choices=[('BIB', 'Bibliotheksstipendium'), ('ELIT', 'eLiteraturstipendium'), ('MAIL', 'E-Mail-Adresse'), ('IFG', 'Kostenübernahme IFG-Anfrage'), ('LIT', 'Literaturstipendium'), ('LIST', 'Mailingliste'), ('TRAV', 'Reisekosten'), ('SOFT', 'Softwarestipendium'), ('VIS', 'Visitenkarten')], default='BIB', max_length=4), + ), + migrations.AlterField( + model_name='list', + name='granted', + field=models.BooleanField(null=True, verbose_name='bewilligt'), + ), + migrations.AlterField( + model_name='list', + name='granted_date', + field=models.DateField(null=True, verbose_name='bewilligt am'), + ), + migrations.AlterField( + model_name='list', + name='intern_notes', + field=models.TextField(blank=True, max_length=1000, verbose_name='interne Anmerkungen'), + ), + migrations.AlterField( + model_name='literature', + name='granted', + field=models.BooleanField(null=True, verbose_name='bewilligt'), + ), + migrations.AlterField( + model_name='literature', + name='granted_date', + field=models.DateField(null=True, verbose_name='bewilligt am'), + ), + migrations.AlterField( + model_name='literature', + name='intern_notes', + field=models.TextField(blank=True, max_length=1000, verbose_name='interne Anmerkungen'), + ), + migrations.AlterField( + model_name='literature', + name='selfbuy', + field=models.CharField(choices=[('TRUE', 'Ich möchte das Werk selbst kaufen und per Kostenerstattung bei Wikimedia Deutschland abrechnen.'), ('FALSE', 'Ich möchte, dass Wikimedia Deutschland das Werk für mich kauft')], default='TRUE', max_length=10, verbose_name='Selbstkauf?'), + ), + migrations.AlterField( + model_name='project', + name='cost', + field=models.IntegerField(blank=True, null=True, verbose_name='Kosten'), + ), + migrations.AlterField( + model_name='project', + name='end_mail_send', + field=models.BooleanField(null=True, verbose_name='Endmail versenden'), + ), + migrations.AlterField( + model_name='project', + name='granted', + field=models.BooleanField(null=True, verbose_name='bewilligt'), + ), + migrations.AlterField( + model_name='project', + name='granted_date', + field=models.DateField(null=True, verbose_name='bewilligt am'), + ), + migrations.AlterField( + model_name='project', + name='intern_notes', + field=models.TextField(blank=True, max_length=1000, verbose_name='interne Anmerkungen'), + ), + migrations.AlterField( + model_name='travel', + name='checkin', + field=models.DateTimeField(blank=True, null=True, verbose_name='Anreise'), + ), + migrations.AlterField( + model_name='travel', + name='checkout', + field=models.DateTimeField(blank=True, null=True, verbose_name='Abreise'), + ), + migrations.AlterField( + model_name='travel', + name='granted', + field=models.BooleanField(null=True, verbose_name='bewilligt'), + ), + migrations.AlterField( + model_name='travel', + name='granted_date', + field=models.DateField(null=True, verbose_name='bewilligt am'), + ), + migrations.AlterField( + model_name='travel', + name='intern_notes', + field=models.TextField(blank=True, max_length=1000, verbose_name='interne Anmerkungen'), + ), + migrations.AlterField( + model_name='travel', + name='notes', + field=models.TextField(blank=True, max_length=1000, verbose_name='Anmerkungen'), + ), + ] diff --git a/input/migrations/0082_auto_20221204_1822.py b/input/migrations/0082_auto_20221204_1822.py new file mode 100644 index 0000000..ae5b196 --- /dev/null +++ b/input/migrations/0082_auto_20221204_1822.py @@ -0,0 +1,23 @@ +# Generated by Django 3.1.2 on 2022-12-04 18:22 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('input', '0081_auto_20221204_1733'), + ] + + operations = [ + migrations.AlterField( + model_name='literature', + name='selfbuy_data', + field=models.TextField(default='', help_text='Bitte gib hier alle persönlichen Daten an, die wir benötigen, um das Werk
für dich zu kaufen und es dir anschließend zu schicken (z.B. Vorname Nachname, Anschrift,
Telefonnummer, E-Mail-Adresse usw.). Trenne die einzelnen Angaben durch Zeilenumbrüche.', max_length=1000, verbose_name='Persönliche Daten sowie Adresse'), + ), + migrations.AlterField( + model_name='literature', + name='selfbuy_give_data', + field=models.BooleanField(help_text='Ich stimme der Weitergabe meiner Daten (Name, Postadresse) an den von mir angegebenen Anbieter/Dienstleister zu.', verbose_name='Datenweitergabe erlauben'), + ), + ] diff --git a/input/migrations/0083_auto_20221205_0946.py b/input/migrations/0083_auto_20221205_0946.py new file mode 100644 index 0000000..81f6d5f --- /dev/null +++ b/input/migrations/0083_auto_20221205_0946.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.2 on 2022-12-05 09:46 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('input', '0082_auto_20221204_1822'), + ] + + operations = [ + migrations.AlterField( + model_name='email', + name='adult', + field=models.CharField(choices=[('TRUE', 'Ich bin volljährig.'), ('FALSE', 'Ich bin noch nicht volljährig.')], default='FALSE', max_length=10, verbose_name='Volljährigkeit'), + ), + ] diff --git a/input/models.py b/input/models.py index fc7ad5b..78d44c4 100755 --- a/input/models.py +++ b/input/models.py @@ -85,7 +85,7 @@ class Project(Volunteer): account = models.ForeignKey('Account', on_delete=models.CASCADE, null=True, to_field='code', db_constraint = False) granted_from = models.CharField(max_length=100,null=True,verbose_name='Bewilligt von') notes = models.TextField(max_length=1000,null=True,blank=True,verbose_name='Anmerkungen') - intern_notes = models.TextField(max_length=1000, blank=True) + intern_notes = models.TextField(max_length=1000, blank=True, verbose_name="interne Anmerkungen") # the following Fields are not supposed to be edited by users pid = models.CharField(max_length=15, null=True, blank=True) @@ -126,7 +126,7 @@ class Project(Volunteer): class Intern(Volunteer): '''abstract base class for data entry from /intern (except Project)''' request_url = models.URLField(max_length=2000, verbose_name='Antrag (URL)') - intern_notes = models.TextField(max_length=1000, blank=True) + intern_notes = models.TextField(max_length=1000, blank=True, verbose_name='interne Anmerkungen') class Meta: abstract = True @@ -138,7 +138,6 @@ class HonoraryCertificate(Intern): ''' this class is also used for accreditations ''' project = models.ForeignKey(Project, null=True, blank=True, on_delete=models.SET_NULL) - def __str__(self): return "Certificate for " + self.realname @@ -150,20 +149,21 @@ TRANSPORT_CHOICES = {'BAHN': 'Bahn', PAYEDBY_CHOICES = {'WMDE': 'WMDE', 'REQU': 'Antragstellender Mensch'} -class Travel(Intern): +class Travel(Volunteer): # project variable is now null true and blank true, which means it can be saved without project id to be later on filled out by admins project = models.ForeignKey(Project, on_delete=models.CASCADE, null=True, blank=True) project_name = models.CharField(max_length=50, null=True, blank=True, verbose_name='Projektname:') transport = models.CharField(max_length=5, choices=TRANSPORT_CHOICES.items(), default='BAHN', verbose_name='Transportmittel:') other_transport = models.CharField(max_length=200, null=True, blank=True, verbose_name='Sonstige Transportmittel (mit Begründung)') - travelcost = models.CharField(max_length=10, default="0", verbose_name="Fahrtkosten") - checkin = models.DateField(blank=True, null=True, verbose_name='Check In') - checkout = models.DateField(blank=True, null=True, verbose_name='Check Out') + travelcost = models.CharField(max_length=10, default="0", verbose_name='Fahrtkosten') + checkin = models.DateTimeField(blank=True, null=True, verbose_name='Anreise') + checkout = models.DateTimeField(blank=True, null=True, verbose_name='Abreise') payed_for_hotel_by = models.CharField(max_length=4, choices=PAYEDBY_CHOICES.items(), blank=True, null=True, verbose_name='Kostenauslage Hotel durch') payed_for_travel_by = models.CharField(max_length=4, choices=PAYEDBY_CHOICES.items(), blank=True, null=True, verbose_name='Kostenauslage Fahrt durch') hotel = models.BooleanField(default=False, verbose_name='Hotelzimmer benötigt:') - notes = models.TextField(max_length=1000, blank=True) - + notes = models.TextField(max_length=1000, blank=True, verbose_name='Anmerkungen') + request_url = models.URLField(max_length=2000, verbose_name='Antrag (URL)') + intern_notes = models.TextField(max_length=1000, blank=True, verbose_name='interne Anmerkungen') #abstract base class for Library and IFG class Grant(Extern): @@ -197,14 +197,13 @@ class Library(Grant): ) library = models.CharField(max_length=200) duration = models.CharField(max_length=100, verbose_name="Dauer") - intern_notes = models.TextField(max_length=1000, blank=True) + intern_notes = models.TextField(max_length=1000, blank=True, verbose_name="interne Anmerkungen") def __str__(self): return self.library SELFBUY_CHOICES = {'TRUE': format_html('Ich möchte das Werk selbst kaufen und per Kostenerstattung bei Wikimedia Deutschland abrechnen.'), 'FALSE': format_html('Ich möchte, dass Wikimedia Deutschland das Werk für mich kauft'), - 'NONE': format_html('Nichts ausgewählt') } @@ -215,20 +214,17 @@ class Literature(Grant): source = models.CharField(max_length=200, verbose_name='Bezugsquelle', 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('Weitergabe meiner Daten (Name, Postadresse) an den von mir angegebenen Anbieter/Dienstleister.')) + 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='', help_text=format_html("Bitte gib hier alle persönlichen Daten an, die wir benötigen, um das Werk
\ für dich zu kaufen und es dir anschließend zu schicken (z.B. Vorname Nachname, Anschrift,
\ - Telefonnummer, E-Mail-Adresse usw.). Trenne die einzelnen Angaben durch Zeilenumbrüche.
\ - Hinweis: Telefonnummern bilden wir üblicherweise im internationalen Format gemäß
\ - DIN 5008 ab. Als anzugebende E-Mail-Adresse empfehlen wir dir eine Wikimedia-Projekt-
\ - Adresse, die du ebenfalls beantragen kannst, sofern du nicht bereits eine besitzt.")) - intern_notes = models.TextField(max_length=1000, blank=True) + Telefonnummer, E-Mail-Adresse usw.). Trenne die einzelnen Angaben durch Zeilenumbrüche.")) + intern_notes = models.TextField(max_length=1000, blank=True, verbose_name="interne Anmerkungen") class IFG(Grant): url = models.URLField(max_length=2000, verbose_name="URL", help_text="Bitte gib den Link zu deiner Anfrage bei Frag den Staat an.") - intern_notes = models.TextField(max_length=1000, blank=True) + intern_notes = models.TextField(max_length=1000, blank=True, verbose_name="interne Anmerkungen") def __str__(self): return "IFG-Anfrage von " + self.realname @@ -252,8 +248,7 @@ MAIL_CHOICES = {'REALNAME': 'Vorname.Nachname', 'OTHER': 'Sonstiges:'} ADULT_CHOICES = {'TRUE': format_html('Ich bin volljährig.'), - 'FALSE': format_html('Ich bin noch nicht volljährig.'), - 'NONE': format_html('Nichts ausgewählt') + 'FALSE': format_html('Ich bin noch nicht volljährig.') } class Email(Domain): @@ -263,14 +258,14 @@ class Email(Domain): help_text=format_html("Bitte gib hier den gewünschten Adressbestandteil an,
der sich vor der Domain befinden soll.")) other = models.CharField(max_length=50,blank=True,null=True, verbose_name="Sonstiges") - adult = models.CharField( max_length=10, verbose_name='Volljährigkeit', choices=ADULT_CHOICES.items(), default='NONE') - intern_notes = models.TextField(max_length=1000, blank=True) + adult = models.CharField( max_length=10, verbose_name='Volljährigkeit', choices=ADULT_CHOICES.items(), default='FALSE') + intern_notes = models.TextField(max_length=1000, blank=True, verbose_name="interne Anmerkungen") class List(Domain): address = models.CharField(max_length=50, default='NO_ADDRESS', verbose_name="Adressbestandteil für Projektmailingliste", help_text=format_html("Bitte gib hier den gewünschten Adressbestandteil an,
der sich vor der Domain befinden soll.")) - intern_notes = models.TextField(max_length=1000, blank=True) + intern_notes = models.TextField(max_length=1000, blank=True, verbose_name="interne Anmerkungen") PROJECT_CHOICE = {'PEDIA': 'Wikipedia', 'SOURCE': 'Wikisource', @@ -307,5 +302,5 @@ class BusinessCard(Extern): sent_to = models.TextField(max_length=1000, verbose_name='Versandadresse', default='', help_text="Bitte gib den Namen und die vollständige Adresse ein, an welche die Visitenkarten geschickt werden sollen.") - send_data_to_print = models.BooleanField(default=False, verbose_name=format_html('Datenweitergabe erlauben'), help_text=format_html('Hiermit erlaube ich die Weitergabe meiner Daten (Name, Postadresse) an den von Wikimedia Deutschland ausgewählten Dienstleister (z. B. wir-machen-druck.de) zum Zwecke des direkten Versands der Druckerzeugnisse an mich.')) - intern_notes = models.TextField(max_length=1000, blank=True) + send_data_to_print = models.BooleanField(default=False, verbose_name=format_html('Datenweitergabe erlauben'), help_text=format_html('Hiermit erlaube ich die Weitergabe meiner Daten (Name, Postadresse) an den von Wikimedia
Deutschland ausgewählten Dienstleister (z. B. wir-machen-druck.de) zum Zwecke des direkten
Versands der Druckerzeugnisse an mich.')) + intern_notes = models.TextField(max_length=1000, blank=True, verbose_name="interne Anmerkungen") diff --git a/input/static/dropdown/js/base.js b/input/static/dropdown/js/base.js index b93cf52..842bb7d 100755 --- a/input/static/dropdown/js/base.js +++ b/input/static/dropdown/js/base.js @@ -54,6 +54,7 @@ window.addEventListener("load", function() { selectField.change(function() { toggleVerified($(this).val()); }); + }); })(django.jQuery); }); diff --git a/input/static/dropdown/js/businessCard.js b/input/static/dropdown/js/businessCard.js new file mode 100644 index 0000000..cec9f9f --- /dev/null +++ b/input/static/dropdown/js/businessCard.js @@ -0,0 +1,28 @@ +window.addEventListener("load", function() { +(function($) { + $(function() { + + var selectField = $('#id_variant'), + verified_div = $('#id_url_of_pic').parent().parent(), + verified_data = $('#id_url_of_pic'); + function toggleVerified(value) { + if (value === 'PIC') { + verified_div.show(); + verified_data.val(""); + } else { + verified_div.hide(); + verified_data.val("NONE"); + } + } + + // show/hide on load based on existing value of selectField + toggleVerified(selectField.val()); + + // show/hide on change + selectField.change(function() { + toggleVerified($(this).val()); + }); + + }); +})(django.jQuery); +}); diff --git a/input/static/dropdown/js/literature.js b/input/static/dropdown/js/literature.js new file mode 100644 index 0000000..893b4a9 --- /dev/null +++ b/input/static/dropdown/js/literature.js @@ -0,0 +1,42 @@ +window.addEventListener("load", function() { +(function($) { + $(function() { + + + // selfbuy section + + var selectField_selfbuy = $('#id_selfbuy'), + verified_selfbuy_div = $('#id_selfbuy_give_data').parent().parent(), + verified_selfbuy = $('#id_selfbuy_give_data'), + data_selfbuy_div = $('#id_selfbuy_data').parent().parent(), + data_selfbuy = $('#id_selfbuy_data'); + + + + // make checked to get through the required + function toggleVerified_selfbuy(value) { + if (value === "FALSE") { + verified_selfbuy_div.show(); + data_selfbuy_div.show(); + data_selfbuy.val(""); + verified_selfbuy.prop("checked", false); + } else { + verified_selfbuy_div.hide(); + data_selfbuy_div.hide(); + data_selfbuy.val("NONE"); + verified_selfbuy.prop("checked", true); + } + } + + // show/hide on load based on existing value of selectField + toggleVerified_selfbuy(selectField_selfbuy.val()); + + // show/hide on change + selectField_selfbuy.change(function() { + toggleVerified_selfbuy($(this).val()); + }); + + }); +})(django.jQuery); +}); + diff --git a/input/static/dropdown/js/mail.js b/input/static/dropdown/js/mail.js new file mode 100644 index 0000000..c5626b8 --- /dev/null +++ b/input/static/dropdown/js/mail.js @@ -0,0 +1,35 @@ +window.addEventListener("load", function() { +(function($) { + $(function() { + + // mail section + + var selectField_addrOther = $('#id_address'), + data_addrOther_div = $('#id_other').parent().parent(), + data_addrOther = $('#id_other'); + console.log(data_addrOther, data_addrOther_div ); + // make checked to get through the required + function toggleVerified_addrOther(value) { + if (value === "OTHER") { + data_addrOther_div.show(); + data_addrOther.val(""); + } else { + data_addrOther_div.hide(); + data_addrOther.val("NONE"); + } + } + + // show/hide on load based on existing value of selectField + toggleVerified_addrOther(selectField_addrOther.val()); + + // show/hide on change + selectField_addrOther.change(function() { + toggleVerified_addrOther($(this).val()); + }); + + + + + }); +})(django.jQuery); +}); diff --git a/input/views.py b/input/views.py index 919c9e5..4dbff38 100755 --- a/input/views.py +++ b/input/views.py @@ -111,9 +111,10 @@ class InternView(LoginRequiredMixin, CookieWizardView): data = {} for form in form_list: data = {**data, **form.cleaned_data} - if data['selfbuy'] == 'TRUE': - data['selfbuy_give_data'] = 'False' - print(data) + + if data['choice'] == 'LIT': + if data['selfbuy'] == 'TRUE': + data['selfbuy_give_data'] = 'False' # write data to database form = form.save(commit=False) @@ -209,9 +210,9 @@ class ExternView(CookieWizardView): data = {} for form in form_list: data = {**data, **form.cleaned_data} - if data['selfbuy'] == 'TRUE': - data['selfbuy_give_data'] = 'False' - print(data) + if data['choice'] == 'LIT': + if data['selfbuy'] == 'TRUE': + data['selfbuy_give_data'] = 'False' # write data to database modell = form.save(commit=False)