arrowcounter/counter/models.py
2019-08-05 15:57:50 +02:00

27 lines
846 B
Python

from django.db import models
from django.conf import settings
from django.contrib.auth.models import User
from django.utils.translation import gettext_lazy as _
class Target(models.Model):
target = models.PositiveIntegerField(_('Target to reach'))
user = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE,
primary_key = True
)
def __str__(self):
return str(self.user) + ' yearly goal: ' + str(self.target)
class ArrowCount(models.Model):
user = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE
)
date = models.DateField(_('Training date'))
count = models.PositiveIntegerField(_('Arrow count for the day'))
def __str__(self):
return str(self.user) + ' on ' + self.date.strftime("%x") + ": " + str(self.count)