From 3c121a60a40cbdc0635d6a3c8780e1c580738a4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniele=20Vigan=C3=B2?= Date: Thu, 8 Jan 2026 12:22:22 +0100 Subject: [PATCH] Extend DCC definitions and clean-up config. Fix a typo in site name (!!) --- ram/portal/templatetags/dcc.py | 8 +-- ram/ram/settings.py | 56 ++++--------------- ...40_alter_rollingstock_decoder_interface.py | 30 ++++++++++ 3 files changed, 45 insertions(+), 49 deletions(-) create mode 100644 ram/roster/migrations/0040_alter_rollingstock_decoder_interface.py diff --git a/ram/portal/templatetags/dcc.py b/ram/portal/templatetags/dcc.py index ab3c1c0..d71193e 100644 --- a/ram/portal/templatetags/dcc.py +++ b/ram/portal/templatetags/dcc.py @@ -17,15 +17,13 @@ def dcc(object): f'' ) if object.decoder: + decoder = mark_safe(f'') if object.decoder.sound: - decoder = mark_safe( - f'' + decoder += mark_safe( '' ) else: - decoder = mark_safe( - f'' + decoder += mark_safe( '' ) if decoder: diff --git a/ram/ram/settings.py b/ram/ram/settings.py index c149e47..6292e15 100644 --- a/ram/ram/settings.py +++ b/ram/ram/settings.py @@ -1,17 +1,7 @@ """ Django settings for ram project. - -Generated by 'django-admin startproject' using Django 4.0. - -For more information on this file, see -https://docs.djangoproject.com/en/4.0/topics/settings/ - -For the full list of settings and their values, see -https://docs.djangoproject.com/en/4.0/ref/settings/ """ -import os -import time from pathlib import Path # Build paths inside the project like this: BASE_DIR / 'subdir'. @@ -23,7 +13,7 @@ STORAGE_DIR = BASE_DIR / "storage" # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = ( - "django-insecure-1fgtf05rwp0qp05@ef@a7%x#o+t6vk6063py=vhdmut0j!8s4u" + "django-ram-insecure-Chang3m3-1n-Pr0duct10n!" ) # SECURITY WARNING: don't run with debug turned on in production! @@ -31,9 +21,6 @@ DEBUG = True ALLOWED_HOSTS = ["*"] - -# Application definition - INSTALLED_APPS = [ "django.contrib.admin", "django.contrib.auth", @@ -87,10 +74,6 @@ TEMPLATES = [ WSGI_APPLICATION = "ram.wsgi.application" - -# Database -# https://docs.djangoproject.com/en/4.0/ref/settings/#databases - DATABASES = { "default": { "ENGINE": "django.db.backends.sqlite3", @@ -98,54 +81,38 @@ DATABASES = { } } - -# Password validation -# https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators - AUTH_PASSWORD_VALIDATORS = [ { - "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator", + "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator", # noqa: E501 }, { - "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator", + "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator", # noqa: E501 }, { - "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator", + "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator", # noqa: E501 }, { - "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator", + "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator", # noqa: E501 }, ] -# Internationalization -# https://docs.djangoproject.com/en/4.0/topics/i18n/ - LANGUAGE_CODE = "en-us" - TIME_ZONE = "UTC" - USE_I18N = True - USE_TZ = True - -# Static files (CSS, JavaScript, Images) -# https://docs.djangoproject.com/en/4.0/howto/static-files/ - STATIC_URL = "static/" -# Default primary key field type -# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field - DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" MEDIA_URL = "media/" MEDIA_ROOT = STORAGE_DIR / "media" +# django-ram REST API settings REST_ENABLED = False # Set to True to enable the REST API REST_FRAMEWORK = { - "DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.LimitOffsetPagination", + "DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.LimitOffsetPagination", # noqa: E501 "PAGE_SIZE": 5, } @@ -171,7 +138,7 @@ COUNTRIES_OVERRIDE = { "XX": "None", } -SITE_NAME = "Railroad Assets Manger" +SITE_NAME = "Railroad Assets Manager" # Image used on cards without a custom image uploaded. # The file must be placed in the root of the 'static' folder @@ -184,9 +151,10 @@ DECODER_INTERFACES = [ (0, "Built-in"), (1, "NEM651"), (2, "NEM652"), - (3, "PluX"), - (4, "21MTC"), - (5, "Next18/Next18S"), + (3, "NEM658 (Plux22)"), + (4, "NEM660 (21MTC)"), + (5, "NEM662 (Next18/Next18S)"), + (3, "NEM658 (Plux16)"), ] MANUFACTURER_TYPES = [ diff --git a/ram/roster/migrations/0040_alter_rollingstock_decoder_interface.py b/ram/roster/migrations/0040_alter_rollingstock_decoder_interface.py new file mode 100644 index 0000000..44c65a5 --- /dev/null +++ b/ram/roster/migrations/0040_alter_rollingstock_decoder_interface.py @@ -0,0 +1,30 @@ +# Generated by Django 6.0 on 2026-01-08 11:14 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("roster", "0039_rollingstock_featured"), + ] + + operations = [ + migrations.AlterField( + model_name="rollingstock", + name="decoder_interface", + field=models.PositiveSmallIntegerField( + blank=True, + choices=[ + (0, "Built-in"), + (1, "NEM651"), + (2, "NEM652"), + (3, "NEM658 (Plux22)"), + (4, "NEM660 (21MTC)"), + (5, "NEM662 (Next18/Next18S)"), + (3, "NEM658 (Plux16)"), + ], + null=True, + ), + ), + ]