45 lines
1.4 KiB
Python
45 lines
1.4 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 gettext_lazy as _
|
|
from django.contrib.auth.models import User
|
|
from auditlog.registry import auditlog
|
|
from phonenumber_field.modelfields import PhoneNumberField
|
|
|
|
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)")),
|
|
)
|
|
|
|
id = models.AutoField(primary_key=True)
|
|
challenger = models.CharField(_("Challenger"), max_length=255)
|
|
victim = models.CharField(_("Victim"), max_length=255)
|
|
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)
|