From 73ad8f90cf7a019a5d604aa5207a15af6b1abe89 Mon Sep 17 00:00:00 2001 From: alpcentaur Date: Mon, 27 Feb 2023 17:09:29 +0000 Subject: [PATCH] changed languages default to german, translated last labels (verbosename) for variables --- foerderbarometer/urls.py | 8 ++++++++ input/admin.py | 2 +- input/management/commands/sendmails.py | 2 -- input/models.py | 10 +++++----- input/settings.py | 6 ++++++ input/urls.py | 4 ++-- input/views.py | 1 + 7 files changed, 23 insertions(+), 10 deletions(-) diff --git a/foerderbarometer/urls.py b/foerderbarometer/urls.py index 7f1b85a..3fdfb85 100755 --- a/foerderbarometer/urls.py +++ b/foerderbarometer/urls.py @@ -15,9 +15,17 @@ Including another URLconf """ from django.contrib import admin from django.urls import path, include +from django.conf.urls.i18n import i18n_patterns urlpatterns = [ path('', include("input.urls")), path('admin/', admin.site.urls), path('accounts/', include('django.contrib.auth.urls')), ] + +#urlpatterns = i18n_patterns('', +# path('', include("input.urls")), +# path('admin/', admin.site.urls), +# path('accounts/', include('django.contrib.auth.urls')), +# #your urls +#) diff --git a/input/admin.py b/input/admin.py index 20db719..469bcf8 100755 --- a/input/admin.py +++ b/input/admin.py @@ -22,7 +22,7 @@ def export_as_csv(self, request, queryset): return response -export_as_csv.short_description = "Export Selected" +export_as_csv.short_description = "Ausgewähltes zu CSV exportieren" admin.site.add_action(export_as_csv) diff --git a/input/management/commands/sendmails.py b/input/management/commands/sendmails.py index 9451cac..43abad3 100755 --- a/input/management/commands/sendmails.py +++ b/input/management/commands/sendmails.py @@ -150,7 +150,6 @@ class Command(BaseCommand): # [IF_EMAIL], # fail_silently=False) - project.end_mail_send = True project.mail_state = 'END' try: project.save() @@ -209,7 +208,6 @@ class Command(BaseCommand): # [IF_EMAIL], # fail_silently=False) - project.end_mail_send = True project.mail_state = 'END' project.save() except BadHeaderError: diff --git a/input/models.py b/input/models.py index 09bf011..fc7ad5b 100755 --- a/input/models.py +++ b/input/models.py @@ -17,8 +17,8 @@ class Volunteer(models.Model): help_text=format_html('Bitte gib deine E-Mail-Adresse ein, damit dich
Wikimedia Deutschland bei Rückfragen oder für
die Zusage kontaktieren kann.')) # the following Fields are not supposed to be edited by users - granted = models.BooleanField(null=True) - granted_date = models.DateField(null=True) + granted = models.BooleanField(null=True, verbose_name='bewilligt') + granted_date = models.DateField(null=True, verbose_name='bewilligt am') survey_mail_send = models.BooleanField(default=False, verbose_name='Keine Umfragemail schicken') survey_mail_date = models.DateField(verbose_name='Umfragemail wurde verschickt am', null=True, blank=True) mail_state = models.CharField(max_length=6, choices=EMAIL_STATES.items(), default='NONE') @@ -61,7 +61,7 @@ class Account(models.Model): code = models.CharField('Kostenstelle', max_length=5, default="DEF", null=False, primary_key = True) description = models.CharField('Beschreibung', max_length=60, default='NO DESCRIPTION') - 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 f"{self.code} {self.description}" @@ -81,7 +81,7 @@ class Project(Volunteer): insurance = models.BooleanField(default=False, verbose_name='Haftpflichtversicherung') insurance_technic = models.BooleanField(default=False, verbose_name='Technikversicherung Ausland') support = models.CharField(max_length=300, blank=True, null=True, verbose_name='Betreuungsperson und Vertretung') - cost = models.IntegerField(blank=True, null=True) + cost = models.IntegerField(blank=True, null=True, verbose_name='Kosten') 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') @@ -89,7 +89,7 @@ class Project(Volunteer): # the following Fields are not supposed to be edited by users pid = models.CharField(max_length=15, null=True, blank=True) - end_mail_send = models.BooleanField(null=True) + end_mail_send = models.BooleanField(null=True, verbose_name='Endmail versenden') status = models.CharField(max_length=3,choices=(('RUN', 'läuft'),('END','beendet'),('NOT','nicht stattgefunden')),default='RUN') persons = models.IntegerField(default=1) finance_id = models.CharField(max_length=15, null= True, blank=True) diff --git a/input/settings.py b/input/settings.py index bda472e..3b43e9a 100755 --- a/input/settings.py +++ b/input/settings.py @@ -12,6 +12,12 @@ DATAPROTECTION = "https://www.wikimedia.de/datenschutz/#datenerfassung" FOERDERRICHTLINIEN = "https://de.wikipedia.org/wiki/Wikipedia:Wikimedia_Deutschland/F%C3%B6rderrichtlinien" NUTZUNGSBEDINGUNGEN = 'static/input/nutzungsbedingungen.html' +LANGUAGE_CODE = 'de' +TIME_ZONE = 'UTC' +USE_I18N = True +USE_L10N = True +USE_TZ = True + ACCOUNTS ={ # "21103": '21103 Willkommen', "DEF": 'DEFAULT VALUE, you hould not see this!', diff --git a/input/urls.py b/input/urls.py index ba4c2b4..e5fd5a9 100755 --- a/input/urls.py +++ b/input/urls.py @@ -1,12 +1,12 @@ from django.urls import path - from .views import ExternView, done, authorize, deny, InternView, export + urlpatterns = [ path('', ExternView.as_view(), name='extern'), # path('intern', InternView.as_view(), name='intern'), path('saved', done, name='done'), path('export', export, name='export'), path('authorize//', authorize, name='authorize'), - path('deny//', deny, name='deny') + path('deny//', deny, name='deny'), ] diff --git a/input/views.py b/input/views.py index d875537..919c9e5 100755 --- a/input/views.py +++ b/input/views.py @@ -12,6 +12,7 @@ from django.template import Context from django.contrib.auth.decorators import login_required from django.contrib.auth.mixins import LoginRequiredMixin from django.utils.html import format_html +from django.utils.translation import gettext as _ from .forms import ProjectForm, ExternForm, LibraryForm, IFGForm, LiteratureForm,\ HonoraryCertificateForm, InternForm, TravelForm, EmailForm,\