diff --git a/coinmanager/coinc/admin.py b/coinmanager/coinc/admin.py index 6ef8699..8afb371 100644 --- a/coinmanager/coinc/admin.py +++ b/coinmanager/coinc/admin.py @@ -20,9 +20,10 @@ from django.contrib import admin -from .models import User, Coin, Country +from .models import User, Coin, Country, Stamp -#admin.site.register(User) -#admin.site.register(Coin) +admin.site.register(User) +admin.site.register(Coin) admin.site.register(Country) +admin.site.register(Stamp) diff --git a/coinmanager/coinc/models.py b/coinmanager/coinc/models.py index 042cf30..e95631d 100644 --- a/coinmanager/coinc/models.py +++ b/coinmanager/coinc/models.py @@ -47,12 +47,30 @@ class Country(Model): euro_member_since = PositiveSmallIntegerField('Währungsmitglied seit', default=year_now) + stamps = ForeignKey('Stamp', on_delete=CASCADE, null=True, blank=True) + def __str__(self): return f"{self.name} - {self.name_iso}, Mitglied seit {self.euro_member_since}" +class Stamp(Model): + name_short = CharField('Prägung', max_length=10) + + name = CharField('Name', max_length=50) + + years = TextField('Im Einsatz in den Jahren ("" entspricht allen Jahren)', default='', blank=True) + + comment = TextField('Kommentar', default='', blank=True) + + + def __str__(self): + return f"{self.name_short} - {self.name} {self.comment}" + + + + class Coin(Model): value = PositiveSmallIntegerField('Wert', default=100) @@ -60,7 +78,7 @@ class Coin(Model): country = ForeignKey('Country', on_delete=CASCADE) - stamp = CharField('Prägerei', max_length=1, default='') + stamp = ForeignKey('Stamp', on_delete=CASCADE, null=True, blank=True) name = TextField('Name', default='', blank=True) diff --git a/coinmanager/db.sqlite3 b/coinmanager/db.sqlite3 index 36c23b6..3b00db3 100644 Binary files a/coinmanager/db.sqlite3 and b/coinmanager/db.sqlite3 differ