update admin view of event
This commit is contained in:
@@ -239,6 +239,9 @@ class Event(Post):
|
||||
class Meta:
|
||||
proxy = True
|
||||
|
||||
verbose_name = "Event"
|
||||
verbose_name_plural = "Events"
|
||||
|
||||
@property
|
||||
def event_start_month(self):
|
||||
return self.event_start.strftime("%b")
|
||||
@@ -247,6 +250,12 @@ class Event(Post):
|
||||
def event_start_day(self):
|
||||
return self.event_start.strftime("%d")
|
||||
|
||||
def clean(self):
|
||||
if self.event_end is None or self.event_start is None:
|
||||
raise ValidationError(_('Das Datum des Events fehlt.'))
|
||||
elif self.event_end < self.event_start:
|
||||
raise ValidationError(_('Das Ende des Events liegt vor dem Beginn.'))
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
self.is_event = True
|
||||
|
||||
@@ -266,6 +275,9 @@ class FetMeeting(Event):
|
||||
verbose_name_plural = "Fet Sitzungen"
|
||||
|
||||
def clean(self):
|
||||
if self.event_start is None:
|
||||
raise ValidationError(_('Das Datum des Events fehlt.'))
|
||||
|
||||
slug = slugify(self.event_start.date()) + "-" + slugify("Fachschaftssitzung")
|
||||
|
||||
if Post.objects.filter(slug=slug).count() != 0:
|
||||
|
||||
Reference in New Issue
Block a user