arrowcounter/counter/models.py

24 lines
727 B
Python
Raw Normal View History

from django.db import models
from django.conf import settings
from django.contrib.auth.models import User
2019-07-27 11:58:09 +00:00
from django.utils.translation import gettext_lazy as _
2019-07-26 21:32:50 +00:00
class Target(models.Model):
2019-07-27 11:58:09 +00:00
target = models.PositiveIntegerField(_('Target to reach'))
2019-07-26 21:32:50 +00:00
user = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE,
primary_key = True
)
class ArrowCount(models.Model):
user = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE
)
2019-07-27 11:58:09 +00:00
date = models.DateField(_('Training date'))
count = models.PositiveIntegerField(_('Arrow count for the day'))
def __str__(self):
return self.date.strftime("%x") + ": " + str(self.count)