Files
web2.0-backend/ohlhafv/models.py
T
2018-01-28 18:54:45 +02:00

45 lines
1.5 KiB
Python

"""Ohlhafv app models."""
from django.db import models
from django.utils import timezone
from datetime import timedelta
from django.contrib.auth.models import User
from webapp.utils import month_from_now
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from auditlog.registry import auditlog
from phonenumber_field.modelfields import PhoneNumberField
from django.contrib.postgres.fields import JSONField
import logging
VERBOSE_NAME = _('Ohlhafv')
class OhlhafvChallenge(models.Model):
"""Model containing all info about ohlhafv challenge."""
class Meta:
verbose_name = _('Ohlhafv challenge')
verbose_name_plural = _('Ohlhafv challenges')
SERIES_CHOICES = (
('0.33 L', '0.33 L'),
('0.5 L', '0.5 L'),
('1.0 L', '1.0 L'),
('Team', _('Team Challenge (1 x 0.33 L, 2 x 0.5 L, 1 x 1.0 L)'))
)
challenger = models.CharField(_('Challenger'), max_length=255)
victim = models.CharField(_('Victim'), max_length=255)
challenger_email = models.EmailField(_('Challenger email'))
victim_email = models.EmailField(_('Victim email'))
series = models.CharField(_('Series'), choices=SERIES_CHOICES, max_length=10)
message = models.TextField(_('Message'), blank=True, null=False)
def __str__(self):
"""Return model info."""
return _('Ohlhafv challenge: {} vs. {}').format(self.challenger, self.victim)
auditlog.register(OhlhafvChallenge)