mirror of
https://github.com/daniviga/django-ram.git
synced 2025-08-05 05:37:50 +02:00
Extend properties
This commit is contained in:
@@ -59,6 +59,9 @@ class RollingClassProperty(models.Model):
|
||||
def __str__(self):
|
||||
return self.property.name
|
||||
|
||||
class Meta:
|
||||
verbose_name_plural = "Properties"
|
||||
|
||||
|
||||
class RollingStock(models.Model):
|
||||
uuid = models.UUIDField(primary_key=True, default=uuid4, editable=False)
|
||||
@@ -133,6 +136,23 @@ class RollingStockImage(models.Model):
|
||||
return "{0}".format(os.path.basename(self.image.name))
|
||||
|
||||
|
||||
class RollingStockProperty(models.Model):
|
||||
rolling_stock = models.ForeignKey(
|
||||
RollingStock,
|
||||
on_delete=models.CASCADE,
|
||||
null=False,
|
||||
blank=False
|
||||
)
|
||||
property = models.ForeignKey(Property, on_delete=models.CASCADE)
|
||||
value = models.CharField(max_length=256)
|
||||
|
||||
def __str__(self):
|
||||
return self.property.name
|
||||
|
||||
class Meta:
|
||||
verbose_name_plural = "Properties"
|
||||
|
||||
|
||||
# @receiver(models.signals.post_delete, sender=Cab)
|
||||
# def post_save_image(sender, instance, *args, **kwargs):
|
||||
# try:
|
||||
|
Reference in New Issue
Block a user