add helptexts
This commit is contained in:
@@ -120,7 +120,7 @@ class NewsAdmin(PostAdmin):
|
|||||||
"status",
|
"status",
|
||||||
"is_pinned",
|
"is_pinned",
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"Bericht",
|
"Bericht",
|
||||||
@@ -129,7 +129,7 @@ class NewsAdmin(PostAdmin):
|
|||||||
"image",
|
"image",
|
||||||
"body",
|
"body",
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"Veröffentlichung",
|
"Veröffentlichung",
|
||||||
@@ -139,7 +139,7 @@ class NewsAdmin(PostAdmin):
|
|||||||
"author",
|
"author",
|
||||||
"public_date",
|
"public_date",
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
inlines = (FileUploadInline,)
|
inlines = (FileUploadInline,)
|
||||||
@@ -172,7 +172,7 @@ class EventAdmin(PostAdmin):
|
|||||||
"status",
|
"status",
|
||||||
"is_pinned",
|
"is_pinned",
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"Event Infos",
|
"Event Infos",
|
||||||
@@ -182,7 +182,7 @@ class EventAdmin(PostAdmin):
|
|||||||
"event_end",
|
"event_end",
|
||||||
"event_place",
|
"event_place",
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"Bericht",
|
"Bericht",
|
||||||
@@ -191,7 +191,7 @@ class EventAdmin(PostAdmin):
|
|||||||
"image",
|
"image",
|
||||||
"body",
|
"body",
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"Veröffentlichung",
|
"Veröffentlichung",
|
||||||
@@ -201,7 +201,7 @@ class EventAdmin(PostAdmin):
|
|||||||
"author",
|
"author",
|
||||||
"public_date",
|
"public_date",
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -217,14 +217,14 @@ class FetMeetingAdmin(EventAdmin):
|
|||||||
fieldsets = (
|
fieldsets = (
|
||||||
(
|
(
|
||||||
None,
|
None,
|
||||||
{
|
{
|
||||||
"fields": (
|
"fields": (
|
||||||
"event_start",
|
"event_start",
|
||||||
"event_end",
|
"event_end",
|
||||||
"event_place",
|
"event_place",
|
||||||
"tags",
|
"tags",
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ from django import forms
|
|||||||
from django.forms.widgets import CheckboxInput
|
from django.forms.widgets import CheckboxInput
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils.dates import MONTHS
|
from django.utils.dates import MONTHS
|
||||||
from django.utils.translation import gettext_lazy as _
|
|
||||||
|
|
||||||
from .models import Post, Event, News, FetMeeting
|
from .models import Post, Event, News, FetMeeting
|
||||||
|
|
||||||
@@ -39,24 +38,24 @@ class NewsForm(PostForm):
|
|||||||
fields = "__all__"
|
fields = "__all__"
|
||||||
|
|
||||||
help_texts = {
|
help_texts = {
|
||||||
"tags": _(
|
"tags": (
|
||||||
"Die Hashtags ohne '#' eintragen, und mit Komma kann man mehrere Tags anfügen."
|
"Die Hashtags ohne '#' eintragen, und mit Komma kann man mehrere Tags anfügen."
|
||||||
),
|
),
|
||||||
"image": _("Verwendbare Formate: ..."),
|
"image": "Verwendbare Formate: ...",
|
||||||
"is_pinned": _(
|
"is_pinned": (
|
||||||
"Dieser Post soll an die Startseite als erster Post angeheftet werden."
|
"Dieser Post soll an die Startseite als erster Post angeheftet werden."
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
labels = {
|
labels = {
|
||||||
"title": _("Titel"),
|
"title": "Titel",
|
||||||
"subtitle": _("Untertitel"),
|
"subtitle": "Untertitel",
|
||||||
"image": _("Hintergrundbild"),
|
"image": "Hintergrundbild",
|
||||||
"body": _("Text"),
|
"body": "Text",
|
||||||
"slug": _("Permalink"),
|
"slug": "Permalink",
|
||||||
"author": _("Autor"),
|
"author": "Autor",
|
||||||
"public_date": _("Veröffentlichung"),
|
"public_date": "Veröffentlichung",
|
||||||
"is_pinned": _("Post anheften"),
|
"is_pinned": "Post anheften",
|
||||||
}
|
}
|
||||||
|
|
||||||
widgets = {"body": CKEditorUploadingWidget(config_name="default")}
|
widgets = {"body": CKEditorUploadingWidget(config_name="default")}
|
||||||
@@ -73,27 +72,27 @@ class EventForm(PostForm):
|
|||||||
fields = "__all__"
|
fields = "__all__"
|
||||||
|
|
||||||
help_texts = {
|
help_texts = {
|
||||||
"tags": _(
|
"tags": (
|
||||||
"Die Hashtags ohne '#' eintragen, und mit Komma kann man mehrere Tags anfügen."
|
"Die Hashtags ohne '#' eintragen, und mit Komma kann man mehrere Tags anfügen."
|
||||||
),
|
),
|
||||||
"image": _("Verwendbare Formate: "),
|
"image": "Verwendbare Formate: Bildformate",
|
||||||
"is_pinned": _(
|
"is_pinned": (
|
||||||
"Dieses Event soll an die Startseite als erster Post angeheftet werden."
|
"Dieses Event soll an die Startseite als erster Post angeheftet werden."
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
labels = {
|
labels = {
|
||||||
"title": _("Titel"),
|
"title": "Titel",
|
||||||
"subtitle": _("Untertitel"),
|
"subtitle": "Untertitel",
|
||||||
"image": _("Hintergrundbild"),
|
"image": "Hintergrundbild",
|
||||||
"body": _("Text"),
|
"body": "Text",
|
||||||
"event_start": _("Start des Events"),
|
"event_start": "Start des Events",
|
||||||
"event_end": _("Ende des Events"),
|
"event_end": "Ende des Events",
|
||||||
"event_place": _("Ort des Events"),
|
"event_place": "Ort des Events",
|
||||||
"slug": _("Permalink"),
|
"slug": "Permalink",
|
||||||
"author": _("Autor"),
|
"author": "Autor",
|
||||||
"public_date": _("Veröffentlichung"),
|
"public_date": "Veröffentlichung",
|
||||||
"is_pinned": _("Event anheften"),
|
"is_pinned": "Event anheften",
|
||||||
}
|
}
|
||||||
|
|
||||||
widgets = {"body": CKEditorUploadingWidget(config_name="default")}
|
widgets = {"body": CKEditorUploadingWidget(config_name="default")}
|
||||||
@@ -116,13 +115,14 @@ class FetMeetingForm(PostForm):
|
|||||||
fields = ["event_start", "event_end", "event_place", "tags"]
|
fields = ["event_start", "event_end", "event_place", "tags"]
|
||||||
|
|
||||||
labels = {
|
labels = {
|
||||||
"event_start": _("Start der Sitzung"),
|
"event_start": "Start der Sitzung",
|
||||||
"event_end": _("Ende der Sitzung"),
|
"event_end": "Ende der Sitzung",
|
||||||
"event_place": _("Ort der Sitzung"),
|
"event_place": "Ort der Sitzung",
|
||||||
}
|
}
|
||||||
|
|
||||||
help_texts = {
|
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."
|
"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_start"].required = True
|
||||||
self.fields["event_end"].required = False
|
self.fields["event_end"].required = False
|
||||||
|
|
||||||
|
self.fields["event_place"].initial = "FET"
|
||||||
|
|
||||||
tags = []
|
tags = []
|
||||||
tags.append(Tag())
|
tags.append(Tag())
|
||||||
tags[0].name = "fachschaft"
|
tags[0].name = "fachschaft"
|
||||||
@@ -140,14 +142,18 @@ class FetMeetingForm(PostForm):
|
|||||||
|
|
||||||
|
|
||||||
class PostSearchForm(forms.Form):
|
class PostSearchForm(forms.Form):
|
||||||
year_choices = [("", _("Alle"))]
|
year_choices = [("", "Alle")]
|
||||||
month_choices = [("", _("Alle"))] + list(MONTHS.items())
|
month_choices = [("", "Alle")] + list(MONTHS.items())
|
||||||
|
|
||||||
year = forms.ChoiceField(label="Jahr", choices=year_choices, required=False)
|
year = forms.ChoiceField(label="Jahr", choices=year_choices, required=False)
|
||||||
month = forms.ChoiceField(label="Monat", choices=month_choices, required=False)
|
month = forms.ChoiceField(label="Monat", choices=month_choices, required=False)
|
||||||
|
|
||||||
compact_view = forms.BooleanField(label="Kompakte Ansicht", required=False, widget=CheckboxInput)
|
compact_view = forms.BooleanField(
|
||||||
fet_meeting_only = forms.BooleanField(label="nur FET Sitzungen", required=False, widget=CheckboxInput)
|
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):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs) # to get the self.fields set
|
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()
|
last_post = Post.objects.get_queryset().first()
|
||||||
if first_post and last_post:
|
if first_post and last_post:
|
||||||
years = range(last_post.date.year, first_post.date.year - 1, -1)
|
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
|
self.fields["year"].choices = year_choices
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user