diff --git a/ram/bookshelf/admin.py b/ram/bookshelf/admin.py index d506558..72cece5 100644 --- a/ram/bookshelf/admin.py +++ b/ram/bookshelf/admin.py @@ -276,8 +276,8 @@ class CatalogAdmin(SortableAdminBase, admin.ModelAdmin): "Publication Year", "Description", "Tags", - "Purchase Date", "Shop", + "Purchase Date", "Price ({})".format(get_site_conf().currency), "Notes", "Properties", diff --git a/ram/bookshelf/models.py b/ram/bookshelf/models.py index 0b81d7c..b059b4e 100644 --- a/ram/bookshelf/models.py +++ b/ram/bookshelf/models.py @@ -5,8 +5,6 @@ from django.conf import settings from django.urls import reverse from django_countries.fields import CountryField -from tinymce import models as tinymce - from ram.utils import DeduplicatedStorage from ram.models import BaseModel, Image, Document, PropertyInstance from metadata.models import Scale, Manufacturer, Shop, Tag @@ -48,7 +46,6 @@ class BaseBook(BaseModel): ) number_of_pages = models.SmallIntegerField(null=True, blank=True) publication_year = models.SmallIntegerField(null=True, blank=True) - description = tinymce.HTMLField(blank=True) shop = models.ForeignKey( Shop, on_delete=models.CASCADE, null=True, blank=True ) diff --git a/ram/bookshelf/serializers.py b/ram/bookshelf/serializers.py index 74c9bef..1aaf59a 100644 --- a/ram/bookshelf/serializers.py +++ b/ram/bookshelf/serializers.py @@ -26,7 +26,12 @@ class BookSerializer(serializers.ModelSerializer): class Meta: model = Book - exclude = ("shop", "purchase_date", "price",) + exclude = ( + "notes", + "shop", + "purchase_date", + "price", + ) read_only_fields = ("creation_time", "updated_time") @@ -37,5 +42,10 @@ class CatalogSerializer(serializers.ModelSerializer): class Meta: model = Catalog - exclude = ("purchase_date", "price",) + exclude = ( + "notes", + "shop", + "purchase_date", + "price", + ) read_only_fields = ("creation_time", "updated_time") diff --git a/ram/consist/admin.py b/ram/consist/admin.py index 58cb60b..fa774f6 100644 --- a/ram/consist/admin.py +++ b/ram/consist/admin.py @@ -49,12 +49,16 @@ class ConsistAdmin(SortableAdminBase, admin.ModelAdmin): "consist_address", "company", "era", + "description", "image", - "notes", "tags", ) }, ), + ( + "Notes", + {"classes": ("collapse",), "fields": ("notes",)}, + ), ( "Audit", { diff --git a/ram/consist/migrations/0015_consist_description.py b/ram/consist/migrations/0015_consist_description.py new file mode 100644 index 0000000..0746440 --- /dev/null +++ b/ram/consist/migrations/0015_consist_description.py @@ -0,0 +1,19 @@ +# Generated by Django 5.1.4 on 2025-01-27 21:15 + +import tinymce.models +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("consist", "0014_alter_consistitem_order"), + ] + + operations = [ + migrations.AddField( + model_name="consist", + name="description", + field=tinymce.models.HTMLField(blank=True), + ), + ] diff --git a/ram/consist/serializers.py b/ram/consist/serializers.py index 947b487..fa45ad1 100644 --- a/ram/consist/serializers.py +++ b/ram/consist/serializers.py @@ -21,4 +21,5 @@ class ConsistSerializer(serializers.ModelSerializer): class Meta: model = Consist - fields = "__all__" + exclude = ("notes",) + read_only_fields = ("creation_time", "updated_time") diff --git a/ram/portal/templates/bookshelf/book.html b/ram/portal/templates/bookshelf/book.html index 3be6e17..607720f 100644 --- a/ram/portal/templates/bookshelf/book.html +++ b/ram/portal/templates/bookshelf/book.html @@ -47,12 +47,10 @@
{% if request.user.is_staff %}Edit{% endif %} diff --git a/ram/portal/templates/consist.html b/ram/portal/templates/consist.html index 7bb77ca..b380005 100644 --- a/ram/portal/templates/consist.html +++ b/ram/portal/templates/consist.html @@ -68,11 +68,9 @@
{% if request.user.is_staff %}Edit{% endif %} diff --git a/ram/portal/templates/rollingstock.html b/ram/portal/templates/rollingstock.html index fbba043..c28e597 100644 --- a/ram/portal/templates/rollingstock.html +++ b/ram/portal/templates/rollingstock.html @@ -51,7 +51,6 @@ {% if rolling_stock.decoder %}{% endif %} {% if documents or decoder_documents %}{% endif %} {% if journal %}{% endif %} - {% if rolling_stock.notes %}{% endif %} {% if set %}{% endif %} {% if consists %}{% endif %} @@ -63,7 +62,6 @@ {% if rolling_stock.decoder %}{% endif %} {% if documents or decoder_documents %}{% endif %} {% if journal %}{% endif %} - {% if rolling_stock.notes %}{% endif %} {% if set %}{% endif %} {% if consists %}{% endif %} @@ -427,9 +425,6 @@
-