Run black on py

This commit is contained in:
2022-04-19 14:25:29 +02:00
parent 13cc531c5d
commit b925af1e7a
13 changed files with 95 additions and 86 deletions

View File

@@ -2,6 +2,7 @@ import os
from uuid import uuid4
from django.db import models
from django.urls import reverse
# from django.core.files.storage import FileSystemStorage
# from django.dispatch import receiver
@@ -32,8 +33,11 @@ class RollingClass(models.Model):
)
description = models.CharField(max_length=256, blank=True)
manufacturer = models.ForeignKey(
Manufacturer, on_delete=models.CASCADE, null=True, blank=True,
limit_choices_to={"category": "real"}
Manufacturer,
on_delete=models.CASCADE,
null=True,
blank=True,
limit_choices_to={"category": "real"},
)
class Meta:
@@ -74,8 +78,11 @@ class RollingStock(models.Model):
)
road_number = models.CharField(max_length=128, unique=False)
manufacturer = models.ForeignKey(
Manufacturer, on_delete=models.CASCADE, null=True, blank=True,
limit_choices_to={"category": "model"}
Manufacturer,
on_delete=models.CASCADE,
null=True,
blank=True,
limit_choices_to={"category": "model"},
)
scale = models.ForeignKey(Scale, on_delete=models.CASCADE)
sku = models.CharField(max_length=32, blank=True)
@@ -112,9 +119,7 @@ class RollingStock(models.Model):
class RollingStockDocument(models.Model):
rolling_stock = models.ForeignKey(
RollingStock,
on_delete=models.CASCADE,
related_name="document"
RollingStock, on_delete=models.CASCADE, related_name="document"
)
description = models.CharField(max_length=128, blank=True)
file = models.FileField(upload_to="files/", null=True, blank=True)
@@ -131,9 +136,7 @@ class RollingStockDocument(models.Model):
class RollingStockImage(models.Model):
rolling_stock = models.ForeignKey(
RollingStock,
on_delete=models.CASCADE,
related_name="image"
RollingStock, on_delete=models.CASCADE, related_name="image"
)
image = models.ImageField(upload_to="images/", null=True, blank=True)
is_thumbnail = models.BooleanField()
@@ -149,7 +152,8 @@ class RollingStockImage(models.Model):
def save(self, **kwargs):
if self.is_thumbnail:
RollingStockImage.objects.filter(
rolling_stock=self.rolling_stock).update(is_thumbnail=False)
rolling_stock=self.rolling_stock
).update(is_thumbnail=False)
super().save(**kwargs)
@@ -159,7 +163,7 @@ class RollingStockProperty(models.Model):
on_delete=models.CASCADE,
related_name="property",
null=False,
blank=False
blank=False,
)
property = models.ForeignKey(Property, on_delete=models.CASCADE)
value = models.CharField(max_length=256)