1
0
Fork 0

rewrote the javascript part

This commit is contained in:
Benni Bärmann 2022-12-05 10:19:03 +00:00
parent b662011618
commit 5335865fcd
12 changed files with 530 additions and 51 deletions

View File

@ -65,9 +65,8 @@ class AccountAdmin(admin.ModelAdmin):
@admin.register(HonoraryCertificate) @admin.register(HonoraryCertificate)
class HonoraryCertificateAdmin(admin.ModelAdmin): class HonoraryCertificateAdmin(admin.ModelAdmin):
save_as = True save_as = True
search_fields = ('realname', 'granted', 'granted_date', 'project') search_fields = ['realname', 'granted']
list_display = ('realname', 'granted', 'granted_date', 'project') list_display = ('realname', 'granted','project')
list_display_links = ('realname', 'project')
date_hierarchy = 'granted_date' date_hierarchy = 'granted_date'
@admin.register(Library) @admin.register(Library)
@ -89,7 +88,7 @@ class IFGAdmin(admin.ModelAdmin):
@admin.register(Travel) @admin.register(Travel)
class TravelAdmin(admin.ModelAdmin): class TravelAdmin(admin.ModelAdmin):
save_as = True save_as = True
search_fields = ('realname', 'granted', 'granted_date', 'project') search_fields = ['realname', 'granted_date']
list_display = ('realname', 'granted', 'granted_date', 'project') list_display = ('realname', 'granted', 'granted_date', 'project')
list_display_links = ('realname', 'project') list_display_links = ('realname', 'project')
date_hierarchy = 'granted_date' date_hierarchy = 'granted_date'
@ -101,6 +100,8 @@ class EmailAdmin(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(List) @admin.register(List)

View File

@ -22,7 +22,7 @@ class ProjectForm(FdbForm):
class Meta: class Meta:
model = Project model = Project
exclude = ('pid', 'project_of_year', 'finance_id','granted', 'granted_date', 'realname', 'email',\ 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(), widgets = {'start': AdminDateWidget(),
'end': AdminDateWidget(),} 'end': AdminDateWidget(),}
@ -38,7 +38,7 @@ class ExternForm(FdbForm):
class Meta: class Meta:
model = ConcreteExtern 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', INTERN_CHOICES = {'PRO': 'Projektsteckbrief',
@ -51,7 +51,7 @@ class InternForm(FdbForm):
class Meta: class Meta:
model = ConcreteVolunteer 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): class TravelForm(FdbForm):
@ -69,19 +69,20 @@ class TravelForm(FdbForm):
class Meta: class Meta:
model = Travel 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(), widgets = {'checkin': AdminDateWidget(),
'checkout': 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 LibraryForm(FdbForm):
class Meta: class Meta:
model = Library model = Library
fields = ['cost', 'library', 'duration', 'notes', 'survey_mail_send'] fields = ['cost', 'library', 'duration', 'notes', 'survey_mail_send']
exclude = ['intern_notes'] exclude = ['intern_notes', 'survey_mail_send', 'mail_state']
class HonoraryCertificateForm(FdbForm): class HonoraryCertificateForm(FdbForm):
class Meta: class Meta:
model = HonoraryCertificate model = HonoraryCertificate
fields = ['request_url', 'project'] fields = ['request_url', 'project']
@ -91,7 +92,7 @@ class IFGForm(FdbForm):
class Meta: class Meta:
model = IFG model = IFG
fields = ['cost', 'url', 'notes'] fields = ['cost', 'url', 'notes']
exclude = ['intern_notes'] exclude = ['intern_notes', 'survey_mail_send', 'mail_state']
class CheckForm(FdbForm): class CheckForm(FdbForm):
@ -108,9 +109,9 @@ class LiteratureForm(CheckForm):
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']
exclude = ['intern_notes'] exclude = ['intern_notes', 'survey_mail_send', 'mail_state']
class Media: class Media:
js = ('dropdown/js/base.js',) js = ('dropdown/js/literature.js',)
class EmailForm(CheckForm): class EmailForm(CheckForm):
@ -118,15 +119,15 @@ class EmailForm(CheckForm):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
self.fields['adult'].required = True self.fields['adult'].required = True
self.fields['other'].required = True
# TODO: add some javascript to show/hide other-field # TODO: add some javascript to show/hide other-field
class Meta: class Meta:
model = Email model = Email
fields = ['domain', 'address', 'other', 'adult'] fields = ['domain', 'address', 'other', 'adult']
exclude = ['intern_notes'] exclude = ['intern_notes', 'survey_mail_send', 'mail_state']
class Media: class Media:
js = ('dropdown/js/base.js',) js = ('dropdown/js/mail.js',)
@ -135,18 +136,19 @@ class BusinessCardForm(CheckForm):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
self.fields['url_of_pic'].required = True self.fields['url_of_pic'].required = True
self.fields['send_data_to_print'].required = True
class Meta: class Meta:
model = BusinessCard model = BusinessCard
exclude = ['intern_notes'] exclude = ['intern_notes', 'survey_mail_send', 'mail_state']
fields = ['project', 'data', 'variant', 'url_of_pic', 'sent_to', 'mail_state'] fields = ['project', 'data', 'variant', 'url_of_pic', 'send_data_to_print', 'sent_to']
class Media: class Media:
js = ('dropdown/js/base.js',) js = ('dropdown/js/businessCard.js',)
class ListForm(CheckForm): class ListForm(CheckForm):
class Meta: class Meta:
model = List model = List
fields = ['domain', 'address'] fields = ['domain', 'address']
exclude = ['intern_notes'] exclude = ['intern_notes', 'survey_mail_send','mail_state']

120
input/logfile Normal file
View File

@ -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: <function OnStarting.on_starting at 0x7f7f819e4c10>
on_reload: <function OnReload.on_reload at 0x7f7f819e4d30>
when_ready: <function WhenReady.when_ready at 0x7f7f819e4e50>
pre_fork: <function Prefork.pre_fork at 0x7f7f819e4f70>
post_fork: <function Postfork.post_fork at 0x7f7f819f60d0>
post_worker_init: <function PostWorkerInit.post_worker_init at 0x7f7f819f61f0>
worker_int: <function WorkerInt.worker_int at 0x7f7f819f6310>
worker_abort: <function WorkerAbort.worker_abort at 0x7f7f819f6430>
pre_exec: <function PreExec.pre_exec at 0x7f7f819f6550>
pre_request: <function PreRequest.pre_request at 0x7f7f819f6670>
post_request: <function PostRequest.post_request at 0x7f7f819f6700>
child_exit: <function ChildExit.child_exit at 0x7f7f819f6820>
worker_exit: <function WorkerExit.worker_exit at 0x7f7f819f6940>
nworkers_changed: <function NumWorkersChanged.nworkers_changed at 0x7f7f819f6a60>
on_exit: <function OnExit.on_exit at 0x7f7f819f6b80>
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 "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", 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.

View File

@ -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<br> Deutschland ausgewählten Dienstleister (z. B. <a href="wir-machen-druck.de">wir-machen-druck.de</a>) zum Zwecke des direkten <br> 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', '<a href="https://de.wikipedia.org/wiki/Wikipedia:Förderung/Zugang_zu_Fachliteratur#Bibliotheksstipendium" target="_blank" rel="noopener">Bibliotheksstipendium</a>'), ('ELIT', '<a href="https://de.wikipedia.org/wiki/Wikipedia:Förderung/Zugang_zu_Fachliteratur#eLiteraturstipendium" target="_blank" rel="noopener">eLiteraturstipendium</a>'), ('MAIL', '<a href="https://de.wikipedia.org/wiki/Wikipedia:Förderung/E-Mail-Adressen_und_Visitenkarten#E-Mail-Adressen" target="_blank" rel="noopener">E-Mail-Adresse</a>'), ('IFG', '<a href="https://de.wikipedia.org/wiki/Wikipedia:Förderung/Gebührenerstattungen_für_Behördenanfragen" target="_blank" rel="noopener">Kostenübernahme IFG-Anfrage</a>'), ('LIT', '<a href="https://de.wikipedia.org/wiki/Wikipedia:Förderung/Zugang_zu_Fachliteratur#Literaturstipendium" target="_blank" rel="noopener">Literaturstipendium</a>'), ('LIST', '<a href="https://de.wikipedia.org/wiki/Wikipedia:Förderung/E-Mail-Adressen_und_Visitenkarten#Mailinglisten" target="_blank" rel="noopener">Mailingliste</a>'), ('TRAV', '<a href="https://de.wikipedia.org/wiki/Wikipedia:F%C3%B6rderung/Reisekostenerstattungen" target="_blank" rel="noopener">Reisekosten</a>'), ('SOFT', '<a href="https://de.wikipedia.org/wiki/Wikipedia:Förderung/Software-Stipendien" target="_blank" rel="noopener">Softwarestipendium</a>'), ('VIS', '<a href="https://de.wikipedia.org/wiki/Wikipedia:Förderung/E-Mail-Adressen_und_Visitenkarten#Visitenkarten" target="_blank" rel="noopener">Visitenkarten</a>')], 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'),
),
]

View File

@ -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<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.', 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'),
),
]

View File

@ -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'),
),
]

View File

@ -85,7 +85,7 @@ class Project(Volunteer):
account = models.ForeignKey('Account', on_delete=models.CASCADE, null=True, to_field='code', db_constraint = False) 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') 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') 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 # the following Fields are not supposed to be edited by users
pid = models.CharField(max_length=15, null=True, blank=True) pid = models.CharField(max_length=15, null=True, blank=True)
@ -126,7 +126,7 @@ class Project(Volunteer):
class Intern(Volunteer): class Intern(Volunteer):
'''abstract base class for data entry from /intern (except Project)''' '''abstract base class for data entry from /intern (except Project)'''
request_url = models.URLField(max_length=2000, verbose_name='Antrag (URL)') 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: class Meta:
abstract = True abstract = True
@ -138,7 +138,6 @@ class HonoraryCertificate(Intern):
''' this class is also used for accreditations ''' ''' this class is also used for accreditations '''
project = models.ForeignKey(Project, null=True, blank=True, on_delete=models.SET_NULL) project = models.ForeignKey(Project, null=True, blank=True, on_delete=models.SET_NULL)
def __str__(self): def __str__(self):
return "Certificate for " + self.realname return "Certificate for " + self.realname
@ -150,20 +149,21 @@ TRANSPORT_CHOICES = {'BAHN': 'Bahn',
PAYEDBY_CHOICES = {'WMDE': 'WMDE', PAYEDBY_CHOICES = {'WMDE': 'WMDE',
'REQU': 'Antragstellender Mensch'} '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 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 = 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:') 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:') 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)') 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") travelcost = models.CharField(max_length=10, default="0", verbose_name='Fahrtkosten')
checkin = models.DateField(blank=True, null=True, verbose_name='Check In') checkin = models.DateTimeField(blank=True, null=True, verbose_name='Anreise')
checkout = models.DateField(blank=True, null=True, verbose_name='Check Out') 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_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') 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:') 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 #abstract base class for Library and IFG
class Grant(Extern): class Grant(Extern):
@ -197,14 +197,13 @@ class Library(Grant):
) )
library = models.CharField(max_length=200) library = models.CharField(max_length=200)
duration = models.CharField(max_length=100, verbose_name="Dauer") 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): def __str__(self):
return self.library return self.library
SELFBUY_CHOICES = {'TRUE': format_html('Ich möchte das Werk selbst kaufen und per Kostenerstattung bei Wikimedia Deutschland abrechnen.'), 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'), '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', source = models.CharField(max_length=200, verbose_name='Bezugsquelle',
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('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='', 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. <br>\ Telefonnummer, E-Mail-Adresse usw.). Trenne die einzelnen Angaben durch Zeilenumbrüche."))
Hinweis: Telefonnummern bilden wir üblicherweise im internationalen Format gemäß<br>\ intern_notes = models.TextField(max_length=1000, blank=True, verbose_name="interne Anmerkungen")
DIN 5008 ab. Als anzugebende E-Mail-Adresse empfehlen wir dir eine Wikimedia-Projekt-<br>\
Adresse, die du ebenfalls beantragen kannst, sofern du nicht bereits eine besitzt."))
intern_notes = models.TextField(max_length=1000, blank=True)
class IFG(Grant): class IFG(Grant):
url = models.URLField(max_length=2000, verbose_name="URL", url = models.URLField(max_length=2000, verbose_name="URL",
help_text="Bitte gib den Link zu deiner Anfrage bei Frag den Staat an.") 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): def __str__(self):
return "IFG-Anfrage von " + self.realname return "IFG-Anfrage von " + self.realname
@ -252,8 +248,7 @@ MAIL_CHOICES = {'REALNAME': 'Vorname.Nachname',
'OTHER': 'Sonstiges:'} 'OTHER': 'Sonstiges:'}
ADULT_CHOICES = {'TRUE': format_html('Ich bin volljährig.'), ADULT_CHOICES = {'TRUE': format_html('Ich bin volljährig.'),
'FALSE': format_html('Ich bin noch nicht volljährig.'), 'FALSE': format_html('Ich bin noch nicht volljährig.')
'NONE': format_html('Nichts ausgewählt')
} }
class Email(Domain): class Email(Domain):
@ -263,14 +258,14 @@ class Email(Domain):
help_text=format_html("Bitte gib hier den gewünschten Adressbestandteil an,<br>der sich vor der Domain befinden soll.")) help_text=format_html("Bitte gib hier den gewünschten Adressbestandteil an,<br>der sich vor der Domain befinden soll."))
other = models.CharField(max_length=50,blank=True,null=True, verbose_name="Sonstiges") 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') 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) intern_notes = models.TextField(max_length=1000, blank=True, verbose_name="interne Anmerkungen")
class List(Domain): class List(Domain):
address = models.CharField(max_length=50, default='NO_ADDRESS', address = models.CharField(max_length=50, default='NO_ADDRESS',
verbose_name="Adressbestandteil für Projektmailingliste", verbose_name="Adressbestandteil für Projektmailingliste",
help_text=format_html("Bitte gib hier den gewünschten Adressbestandteil an,<br>der sich vor der Domain befinden soll.")) help_text=format_html("Bitte gib hier den gewünschten Adressbestandteil an,<br>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', PROJECT_CHOICE = {'PEDIA': 'Wikipedia',
'SOURCE': 'Wikisource', 'SOURCE': 'Wikisource',
@ -307,5 +302,5 @@ class BusinessCard(Extern):
sent_to = models.TextField(max_length=1000, verbose_name='Versandadresse', 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.") 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. <a href="wir-machen-druck.de">wir-machen-druck.de</a>) zum Zwecke des direkten Versands der Druckerzeugnisse an mich.')) 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<br> Deutschland ausgewählten Dienstleister (z. B. <a href="wir-machen-druck.de">wir-machen-druck.de</a>) zum Zwecke des direkten <br> Versands der Druckerzeugnisse an mich.'))
intern_notes = models.TextField(max_length=1000, blank=True) intern_notes = models.TextField(max_length=1000, blank=True, verbose_name="interne Anmerkungen")

View File

@ -54,6 +54,7 @@ window.addEventListener("load", function() {
selectField.change(function() { selectField.change(function() {
toggleVerified($(this).val()); toggleVerified($(this).val());
}); });
}); });
})(django.jQuery); })(django.jQuery);
}); });

View File

@ -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);
});

View File

@ -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);
});

View File

@ -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);
});

View File

@ -111,9 +111,10 @@ class InternView(LoginRequiredMixin, 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['selfbuy'] == 'TRUE': if data['selfbuy'] == 'TRUE':
data['selfbuy_give_data'] = 'False' data['selfbuy_give_data'] = 'False'
print(data)
# write data to database # write data to database
form = form.save(commit=False) form = form.save(commit=False)
@ -209,9 +210,9 @@ 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['selfbuy'] == 'TRUE': if data['selfbuy'] == 'TRUE':
data['selfbuy_give_data'] = 'False' data['selfbuy_give_data'] = 'False'
print(data)
# write data to database # write data to database
modell = form.save(commit=False) modell = form.save(commit=False)