Browse Source

Option to allow empty runtimes (without even a start date).

master
Erik Stein 7 years ago
parent
commit
9dbb8410c1
  1. 1
      CHANGES
  2. 6
      shared/utils/models/events.py

1
CHANGES

@ -1,5 +1,6 @@
0.2.13 2018-10-13 0.2.13 2018-10-13
- Improved USE_TRANSLATABLE_FIELDS - Improved USE_TRANSLATABLE_FIELDS
- Option to allow empty runtimes (without even a start date).
0.2.12 2018-09-28 0.2.12 2018-09-28
- Additional text template tags. - Additional text template tags.

6
shared/utils/models/events.py

@ -7,8 +7,8 @@ from django.core.exceptions import ValidationError
from django.db import models from django.db import models
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from shared.utils.dateformat import format_partial_date, format_date_range
from ..conf import USE_TRANSLATABLE_FIELDS from ..conf import USE_TRANSLATABLE_FIELDS
from ..dateformat import format_partial_date, format_date_range
if USE_TRANSLATABLE_FIELDS: if USE_TRANSLATABLE_FIELDS:
@ -40,11 +40,13 @@ class RuntimeMixin(models.Model):
max_length=200, null=True, blank=True, max_length=200, null=True, blank=True,
help_text=_("Alternativer Text für die Laufzeitangabe")) help_text=_("Alternativer Text für die Laufzeitangabe"))
allow_empty_runtime = False
class Meta: class Meta:
abstract = True abstract = True
def clean(self): def clean(self):
if not (self.from_year_value or self.until_year_value): if not self.allow_empty_runtime and not (self.from_year_value or self.until_year_value):
raise ValidationError(_('Please enter either a from or an until date year.')) raise ValidationError(_('Please enter either a from or an until date year.'))
# Update from/sort date fields # Update from/sort date fields

Loading…
Cancel
Save