Refactor rolling stock

This commit is contained in:
2022-03-30 23:15:24 +02:00
parent 91e6dd0cac
commit fd76b2df28
25 changed files with 600 additions and 17 deletions

View File

@@ -1,4 +1,5 @@
from django.db import models
from django.conf import settings
from django.dispatch.dispatcher import receiver
from django_countries.fields import CountryField
@@ -81,3 +82,15 @@ class Tag(models.Model):
@receiver(models.signals.pre_save, sender=Tag)
def tag_pre_save(sender, instance, **kwargs):
instance.slug = slugify(instance.name)
class RollingStockType(models.Model):
type = models.CharField(max_length=64)
category = models.CharField(
max_length=64, choices=settings.ROLLING_STOCK_TYPES)
class Meta(object):
unique_together = ('category', 'type')
def __str__(self):
return "{0}".format(self.type)