diff --git a/fet2020/posts/admin.py b/fet2020/posts/admin.py index babb94b9..9c548f20 100644 --- a/fet2020/posts/admin.py +++ b/fet2020/posts/admin.py @@ -120,7 +120,7 @@ class NewsAdmin(PostAdmin): "status", "is_pinned", ) - } + }, ), ( "Bericht", @@ -129,7 +129,7 @@ class NewsAdmin(PostAdmin): "image", "body", ) - } + }, ), ( "Veröffentlichung", @@ -139,7 +139,7 @@ class NewsAdmin(PostAdmin): "author", "public_date", ) - } + }, ), ) inlines = (FileUploadInline,) @@ -172,7 +172,7 @@ class EventAdmin(PostAdmin): "status", "is_pinned", ) - } + }, ), ( "Event Infos", @@ -182,7 +182,7 @@ class EventAdmin(PostAdmin): "event_end", "event_place", ) - } + }, ), ( "Bericht", @@ -191,7 +191,7 @@ class EventAdmin(PostAdmin): "image", "body", ) - } + }, ), ( "Veröffentlichung", @@ -201,7 +201,7 @@ class EventAdmin(PostAdmin): "author", "public_date", ) - } + }, ), ) @@ -217,14 +217,14 @@ class FetMeetingAdmin(EventAdmin): fieldsets = ( ( None, - { + { "fields": ( "event_start", "event_end", "event_place", "tags", ) - } + }, ), ) diff --git a/fet2020/posts/forms.py b/fet2020/posts/forms.py index 0ccfc8b5..38677f3c 100644 --- a/fet2020/posts/forms.py +++ b/fet2020/posts/forms.py @@ -5,7 +5,6 @@ from django import forms from django.forms.widgets import CheckboxInput from django.utils import timezone from django.utils.dates import MONTHS -from django.utils.translation import gettext_lazy as _ from .models import Post, Event, News, FetMeeting @@ -39,24 +38,24 @@ class NewsForm(PostForm): fields = "__all__" help_texts = { - "tags": _( + "tags": ( "Die Hashtags ohne '#' eintragen, und mit Komma kann man mehrere Tags anfügen." ), - "image": _("Verwendbare Formate: ..."), - "is_pinned": _( + "image": "Verwendbare Formate: ...", + "is_pinned": ( "Dieser Post soll an die Startseite als erster Post angeheftet werden." ), } labels = { - "title": _("Titel"), - "subtitle": _("Untertitel"), - "image": _("Hintergrundbild"), - "body": _("Text"), - "slug": _("Permalink"), - "author": _("Autor"), - "public_date": _("Veröffentlichung"), - "is_pinned": _("Post anheften"), + "title": "Titel", + "subtitle": "Untertitel", + "image": "Hintergrundbild", + "body": "Text", + "slug": "Permalink", + "author": "Autor", + "public_date": "Veröffentlichung", + "is_pinned": "Post anheften", } widgets = {"body": CKEditorUploadingWidget(config_name="default")} @@ -73,27 +72,27 @@ class EventForm(PostForm): fields = "__all__" help_texts = { - "tags": _( + "tags": ( "Die Hashtags ohne '#' eintragen, und mit Komma kann man mehrere Tags anfügen." ), - "image": _("Verwendbare Formate: "), - "is_pinned": _( + "image": "Verwendbare Formate: Bildformate", + "is_pinned": ( "Dieses Event soll an die Startseite als erster Post angeheftet werden." ), } labels = { - "title": _("Titel"), - "subtitle": _("Untertitel"), - "image": _("Hintergrundbild"), - "body": _("Text"), - "event_start": _("Start des Events"), - "event_end": _("Ende des Events"), - "event_place": _("Ort des Events"), - "slug": _("Permalink"), - "author": _("Autor"), - "public_date": _("Veröffentlichung"), - "is_pinned": _("Event anheften"), + "title": "Titel", + "subtitle": "Untertitel", + "image": "Hintergrundbild", + "body": "Text", + "event_start": "Start des Events", + "event_end": "Ende des Events", + "event_place": "Ort des Events", + "slug": "Permalink", + "author": "Autor", + "public_date": "Veröffentlichung", + "is_pinned": "Event anheften", } widgets = {"body": CKEditorUploadingWidget(config_name="default")} @@ -116,13 +115,14 @@ class FetMeetingForm(PostForm): fields = ["event_start", "event_end", "event_place", "tags"] labels = { - "event_start": _("Start der Sitzung"), - "event_end": _("Ende der Sitzung"), - "event_place": _("Ort der Sitzung"), + "event_start": "Start der Sitzung", + "event_end": "Ende der Sitzung", + "event_place": "Ort der Sitzung", } help_texts = { - "tags": _( + "event_end": "Bei leeren Eingabe werden 2h zur Startzeit dazugezählt.", + "tags": ( "Die Hashtags ohne '#' eintragen, und mit Komma kann man mehrere Tags anfügen." ), } @@ -133,6 +133,8 @@ class FetMeetingForm(PostForm): self.fields["event_start"].required = True self.fields["event_end"].required = False + self.fields["event_place"].initial = "FET" + tags = [] tags.append(Tag()) tags[0].name = "fachschaft" @@ -140,14 +142,18 @@ class FetMeetingForm(PostForm): class PostSearchForm(forms.Form): - year_choices = [("", _("Alle"))] - month_choices = [("", _("Alle"))] + list(MONTHS.items()) + year_choices = [("", "Alle")] + month_choices = [("", "Alle")] + list(MONTHS.items()) year = forms.ChoiceField(label="Jahr", choices=year_choices, required=False) month = forms.ChoiceField(label="Monat", choices=month_choices, required=False) - compact_view = forms.BooleanField(label="Kompakte Ansicht", required=False, widget=CheckboxInput) - fet_meeting_only = forms.BooleanField(label="nur FET Sitzungen", required=False, widget=CheckboxInput) + compact_view = forms.BooleanField( + label="Kompakte Ansicht", required=False, widget=CheckboxInput + ) + fet_meeting_only = forms.BooleanField( + label="nur FET Sitzungen", required=False, widget=CheckboxInput + ) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # to get the self.fields set @@ -157,7 +163,7 @@ class PostSearchForm(forms.Form): last_post = Post.objects.get_queryset().first() if first_post and last_post: years = range(last_post.date.year, first_post.date.year - 1, -1) - year_choices = [("", _("Alle"))] + [(i, i) for i in years] + year_choices = [("", "Alle")] + [(i, i) for i in years] self.fields["year"].choices = year_choices except: pass