mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-26 18:10:36 +00:00
Sets minimum goal
This commit is contained in:
parent
146e92480b
commit
6efe4d54f0
1 changed files with 4 additions and 1 deletions
|
@ -4,6 +4,7 @@ from urllib.parse import urlparse
|
|||
|
||||
from django.apps import apps
|
||||
from django.contrib.auth.models import AbstractUser
|
||||
from django.core.validators import MinValueValidator
|
||||
from django.db import models
|
||||
from django.dispatch import receiver
|
||||
from django.utils import timezone
|
||||
|
@ -226,7 +227,9 @@ class KeyPair(ActivitypubMixin, BookWyrmModel):
|
|||
class AnnualGoal(BookWyrmModel):
|
||||
''' set a goal for how many books you read in a year '''
|
||||
user = models.ForeignKey('User', on_delete=models.PROTECT)
|
||||
goal = models.IntegerField()
|
||||
goal = models.IntegerField(
|
||||
validators=[MinValueValidator(1)]
|
||||
)
|
||||
year = models.IntegerField(default=timezone.now().year)
|
||||
privacy = models.CharField(
|
||||
max_length=255,
|
||||
|
|
Loading…
Reference in a new issue