diff --git a/ram/portal/templates/rollingstock.html b/ram/portal/templates/rollingstock.html
index d40818d..f95eda6 100644
--- a/ram/portal/templates/rollingstock.html
+++ b/ram/portal/templates/rollingstock.html
@@ -262,9 +262,12 @@
Manufacturer |
- {%if class.manufacturer %}
- {{ class.manufacturer }}{% if class.manufacturer.website %} {% endif %}
- {% else %}-{% endif %}
+ {% for m in class.manufacturer.all %}
+ {% if not forloop.first %} / {% endif %}
+ {{ m }}{% if m.website %} {% endif %}
+ {% empty %}
+ -
+ {% endfor %}
|
{% if class.description %}
diff --git a/ram/ram/__init__.py b/ram/ram/__init__.py
index a070a7e..0270948 100644
--- a/ram/ram/__init__.py
+++ b/ram/ram/__init__.py
@@ -1,4 +1,4 @@
from ram.utils import git_suffix
-__version__ = "0.16.3"
+__version__ = "0.16.4"
__version__ += git_suffix(__file__)
diff --git a/ram/roster/migrations/0033_rename_manufacturer_rollingclass_manufacturer_old.py b/ram/roster/migrations/0033_rename_manufacturer_rollingclass_manufacturer_old.py
new file mode 100644
index 0000000..92b28a3
--- /dev/null
+++ b/ram/roster/migrations/0033_rename_manufacturer_rollingclass_manufacturer_old.py
@@ -0,0 +1,45 @@
+# Generated by Django 5.1.4 on 2025-01-20 21:25
+
+from django.db import migrations, models
+
+
+def manufacturer_to_many(apps, schema_editor):
+ rolling_class = apps.get_model("roster", "RollingClass")
+ for row in rolling_class.objects.all():
+ manufacturer = row.manufacturer_old
+ if manufacturer:
+ row.manufacturer.add(manufacturer)
+ row.save()
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ("metadata", "0022_decoderdocument_creation_time_and_more"),
+ ("roster", "0032_rollingstockdocument_creation_time_and_more"),
+ ]
+
+ operations = [
+ migrations.RenameField(
+ model_name="rollingclass",
+ old_name="manufacturer",
+ new_name="manufacturer_old",
+ ),
+ migrations.AddField(
+ model_name="rollingclass",
+ name="manufacturer",
+ field=models.ManyToManyField(
+ blank=True,
+ limit_choices_to={"category": "real"},
+ to="metadata.manufacturer",
+ ),
+ ),
+ migrations.RunPython(
+ manufacturer_to_many,
+ reverse_code=migrations.RunPython.noop
+ ),
+ migrations.RemoveField(
+ model_name="rollingclass",
+ name="manufacturer_old",
+ ),
+ ]
diff --git a/ram/roster/models.py b/ram/roster/models.py
index af26726..479ad5c 100644
--- a/ram/roster/models.py
+++ b/ram/roster/models.py
@@ -26,10 +26,8 @@ class RollingClass(models.Model):
type = models.ForeignKey(RollingStockType, on_delete=models.CASCADE)
company = models.ForeignKey(Company, on_delete=models.CASCADE)
description = tinymce.HTMLField(blank=True)
- manufacturer = models.ForeignKey(
+ manufacturer = models.ManyToManyField(
Manufacturer,
- on_delete=models.CASCADE,
- null=True,
blank=True,
limit_choices_to={"category": "real"},
)
diff --git a/ram/roster/serializers.py b/ram/roster/serializers.py
index f7e71ae..e5d5aed 100644
--- a/ram/roster/serializers.py
+++ b/ram/roster/serializers.py
@@ -11,6 +11,7 @@ from metadata.serializers import (
class RollingClassSerializer(serializers.ModelSerializer):
+ manufacturer = ManufacturerSerializer(many=True)
company = CompanySerializer()
type = RollingStockTypeSerializer()