From 6d8a75aad3e29ccda5fb91b87efb6140845aaa7b Mon Sep 17 00:00:00 2001 From: koksnuss Date: Mon, 20 Apr 2020 15:22:22 +0200 Subject: [PATCH] add comment field to Country, change wording of member_since to euro_member_since --- coinmanager/coinc/models.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/coinmanager/coinc/models.py b/coinmanager/coinc/models.py index 19119a7..042cf30 100644 --- a/coinmanager/coinc/models.py +++ b/coinmanager/coinc/models.py @@ -23,6 +23,9 @@ from datetime import datetime from django.db.models import BooleanField, CASCADE, CharField, DateField, ForeignKey, Model, PositiveIntegerField, PositiveSmallIntegerField, TextField +year_now = int(datetime.now().year) + + class User(Model): name = CharField('Name', max_length=50, default='Anonym') @@ -40,18 +43,19 @@ class Country(Model): name = CharField('Land', max_length=50) - member_since = PositiveSmallIntegerField('Mitglied seit') + comment = TextField('Kommentar', default='', blank=True) + + euro_member_since = PositiveSmallIntegerField('Währungsmitglied seit', default=year_now) def __str__(self): - return f"{self.name} - {self.name_iso}, Mitglied seit {self.member_since}" + return f"{self.name} - {self.name_iso}, Mitglied seit {self.euro_member_since}" class Coin(Model): value = PositiveSmallIntegerField('Wert', default=100) - year_now = int(datetime.now().year) year = PositiveSmallIntegerField('Jahr', default=year_now) country = ForeignKey('Country', on_delete=CASCADE)