mirror of
https://github.com/daniviga/django-ram.git
synced 2025-08-04 13:17:50 +02:00
Implement support for sets and other improvements (#34)
* Add a boolean to define item as part of a set * Add contextual help in admin * Introduce support to sets and to item code lookup Also review the url path for pagination
This commit is contained in:
@@ -141,6 +141,7 @@ class RollingStockAdmin(SortableAdminBase, admin.ModelAdmin):
|
||||
"scale",
|
||||
"manufacturer",
|
||||
"item_number",
|
||||
"set",
|
||||
"era",
|
||||
"description",
|
||||
"production_year",
|
||||
|
@@ -0,0 +1,40 @@
|
||||
# Generated by Django 5.0.4 on 2024-04-20 12:55
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("roster", "0024_rollingstock_description"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="rollingstock",
|
||||
name="set",
|
||||
field=models.BooleanField(default=False, help_text="Part of a set"),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="rollingstock",
|
||||
name="era",
|
||||
field=models.CharField(
|
||||
blank=True, help_text="Era or epoch of the model", max_length=32
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="rollingstock",
|
||||
name="item_number",
|
||||
field=models.CharField(
|
||||
blank=True, help_text="Catalog item number or code", max_length=32
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="rollingstockjournal",
|
||||
name="private",
|
||||
field=models.BooleanField(
|
||||
default=False,
|
||||
help_text="Journal log will be visible only to logged users",
|
||||
),
|
||||
),
|
||||
]
|
@@ -74,7 +74,15 @@ class RollingStock(models.Model):
|
||||
limit_choices_to={"category": "model"},
|
||||
)
|
||||
scale = models.ForeignKey(Scale, on_delete=models.CASCADE)
|
||||
item_number = models.CharField(max_length=32, blank=True)
|
||||
item_number = models.CharField(
|
||||
max_length=32,
|
||||
blank=True,
|
||||
help_text="Catalog item number or code",
|
||||
)
|
||||
set = models.BooleanField(
|
||||
default=False,
|
||||
help_text="Part of a set",
|
||||
)
|
||||
decoder_interface = models.PositiveSmallIntegerField(
|
||||
choices=settings.DECODER_INTERFACES, null=True, blank=True
|
||||
)
|
||||
@@ -82,7 +90,11 @@ class RollingStock(models.Model):
|
||||
Decoder, on_delete=models.CASCADE, null=True, blank=True
|
||||
)
|
||||
address = models.SmallIntegerField(default=None, null=True, blank=True)
|
||||
era = models.CharField(max_length=32, blank=True)
|
||||
era = models.CharField(
|
||||
max_length=32,
|
||||
blank=True,
|
||||
help_text="Era or epoch of the model",
|
||||
)
|
||||
production_year = models.SmallIntegerField(null=True, blank=True)
|
||||
purchase_date = models.DateField(null=True, blank=True)
|
||||
description = tinymce.HTMLField(blank=True)
|
||||
@@ -177,7 +189,10 @@ class RollingStockJournal(models.Model):
|
||||
)
|
||||
date = models.DateField()
|
||||
log = tinymce.HTMLField()
|
||||
private = models.BooleanField(default=False)
|
||||
private = models.BooleanField(
|
||||
default=False,
|
||||
help_text="Journal log will be visible only to logged users",
|
||||
)
|
||||
creation_time = models.DateTimeField(auto_now_add=True)
|
||||
updated_time = models.DateTimeField(auto_now=True)
|
||||
|
||||
|
Reference in New Issue
Block a user