mirror of
https://github.com/daniviga/django-ram.git
synced 2025-08-04 05:07:50 +02:00
Run black
This commit is contained in:
@@ -9,11 +9,7 @@ class DriverConfigurationAdmin(SingletonModelAdmin):
|
|||||||
fieldsets = (
|
fieldsets = (
|
||||||
(
|
(
|
||||||
"General configuration",
|
"General configuration",
|
||||||
{
|
{"fields": ("enabled",)},
|
||||||
"fields": (
|
|
||||||
"enabled",
|
|
||||||
)
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"Remote DCC-EX configuration",
|
"Remote DCC-EX configuration",
|
||||||
|
@@ -63,7 +63,7 @@ class Decoder(models.Model):
|
|||||||
manufacturer = models.ForeignKey(
|
manufacturer = models.ForeignKey(
|
||||||
Manufacturer,
|
Manufacturer,
|
||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
limit_choices_to={"category": "model"}
|
limit_choices_to={"category": "model"},
|
||||||
)
|
)
|
||||||
version = models.CharField(max_length=64, blank=True)
|
version = models.CharField(max_length=64, blank=True)
|
||||||
interface = models.PositiveSmallIntegerField(
|
interface = models.PositiveSmallIntegerField(
|
||||||
|
@@ -14,14 +14,16 @@ class SiteConfiguration(SingletonModel):
|
|||||||
items_per_page = models.CharField(
|
items_per_page = models.CharField(
|
||||||
max_length=2,
|
max_length=2,
|
||||||
choices=[(str(x * 3), str(x * 3)) for x in range(2, 11)],
|
choices=[(str(x * 3), str(x * 3)) for x in range(2, 11)],
|
||||||
default="6"
|
default="6",
|
||||||
)
|
)
|
||||||
items_ordering = models.CharField(
|
items_ordering = models.CharField(
|
||||||
max_length=10,
|
max_length=10,
|
||||||
choices=[("type", "By rolling stock type"),
|
choices=[
|
||||||
("company", "By company name"),
|
("type", "By rolling stock type"),
|
||||||
("identifier", "By rolling stock class")],
|
("company", "By company name"),
|
||||||
default="type"
|
("identifier", "By rolling stock class"),
|
||||||
|
],
|
||||||
|
default="type",
|
||||||
)
|
)
|
||||||
footer = models.TextField(blank=True)
|
footer = models.TextField(blank=True)
|
||||||
footer_extended = models.TextField(blank=True)
|
footer_extended = models.TextField(blank=True)
|
||||||
|
@@ -24,8 +24,7 @@ urlpatterns = [
|
|||||||
),
|
),
|
||||||
path("consists", Consists.as_view(), name="consists"),
|
path("consists", Consists.as_view(), name="consists"),
|
||||||
path(
|
path(
|
||||||
"consists/<int:page>",
|
"consists/<int:page>", Consists.as_view(), name="consists_pagination"
|
||||||
Consists.as_view(), name="consists_pagination"
|
|
||||||
),
|
),
|
||||||
path("consist/<uuid:uuid>", GetConsist.as_view(), name="consist"),
|
path("consist/<uuid:uuid>", GetConsist.as_view(), name="consist"),
|
||||||
path(
|
path(
|
||||||
|
@@ -170,7 +170,7 @@ class Consists(View):
|
|||||||
return render(
|
return render(
|
||||||
request,
|
request,
|
||||||
"consists.html",
|
"consists.html",
|
||||||
{"consist": consist, "page_range": page_range}
|
{"consist": consist, "page_range": page_range},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -193,6 +193,6 @@ class GetConsist(View):
|
|||||||
{
|
{
|
||||||
"consist": consist,
|
"consist": consist,
|
||||||
"rolling_stock": rolling_stock,
|
"rolling_stock": rolling_stock,
|
||||||
"page_range": page_range
|
"page_range": page_range,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@@ -34,13 +34,21 @@ if settings.DEBUG:
|
|||||||
from rest_framework.schemas import get_schema_view
|
from rest_framework.schemas import get_schema_view
|
||||||
|
|
||||||
urlpatterns += [
|
urlpatterns += [
|
||||||
path('swagger/', TemplateView.as_view(
|
path(
|
||||||
template_name='swagger.html',
|
"swagger/",
|
||||||
extra_context={'schema_url': 'openapi-schema'}
|
TemplateView.as_view(
|
||||||
), name='swagger'),
|
template_name="swagger.html",
|
||||||
path('openapi', get_schema_view(
|
extra_context={"schema_url": "openapi-schema"},
|
||||||
title="RAM - Railroad Assets Manager",
|
),
|
||||||
description="RAM API",
|
name="swagger",
|
||||||
version="1.0.0"
|
),
|
||||||
), name='openapi-schema'),
|
path(
|
||||||
|
"openapi",
|
||||||
|
get_schema_view(
|
||||||
|
title="RAM - Railroad Assets Manager",
|
||||||
|
description="RAM API",
|
||||||
|
version="1.0.0",
|
||||||
|
),
|
||||||
|
name="openapi-schema",
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
@@ -121,7 +121,8 @@ class RollingStock(models.Model):
|
|||||||
def pre_save_running_number(sender, instance, *args, **kwargs):
|
def pre_save_running_number(sender, instance, *args, **kwargs):
|
||||||
try:
|
try:
|
||||||
instance.road_number_int = int(
|
instance.road_number_int = int(
|
||||||
re.findall(r"\d+", instance.road_number)[0])
|
re.findall(r"\d+", instance.road_number)[0]
|
||||||
|
)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@@ -15,17 +15,13 @@ class RosterGet(RetrieveAPIView):
|
|||||||
serializer_class = RollingStockSerializer
|
serializer_class = RollingStockSerializer
|
||||||
lookup_field = "uuid"
|
lookup_field = "uuid"
|
||||||
|
|
||||||
schema = AutoSchema(
|
schema = AutoSchema(operation_id_base="retrieveRollingStockByUUID")
|
||||||
operation_id_base="retrieveRollingStockByUUID"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class RosterAddress(ListAPIView):
|
class RosterAddress(ListAPIView):
|
||||||
serializer_class = RollingStockSerializer
|
serializer_class = RollingStockSerializer
|
||||||
|
|
||||||
schema = AutoSchema(
|
schema = AutoSchema(operation_id_base="retrieveRollingStockByAddress")
|
||||||
operation_id_base="retrieveRollingStockByAddress"
|
|
||||||
)
|
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
address = self.kwargs["address"]
|
address = self.kwargs["address"]
|
||||||
@@ -35,9 +31,7 @@ class RosterAddress(ListAPIView):
|
|||||||
class RosterClass(ListAPIView):
|
class RosterClass(ListAPIView):
|
||||||
serializer_class = RollingStockSerializer
|
serializer_class = RollingStockSerializer
|
||||||
|
|
||||||
schema = AutoSchema(
|
schema = AutoSchema(operation_id_base="retrieveRollingStockByClass")
|
||||||
operation_id_base="retrieveRollingStockByClass"
|
|
||||||
)
|
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
_class = self.kwargs["class"]
|
_class = self.kwargs["class"]
|
||||||
|
Reference in New Issue
Block a user