From 353da224be0f392f9aa1ec90d2668d409f2259e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniele=20Vigan=C3=B2?= Date: Sun, 10 Jul 2022 22:48:45 +0200 Subject: [PATCH] Fix consists pagination and remove hardcoded urls --- .../migrations/0002_alter_consist_options.py | 17 +++++++++++++++++ ram/consist/models.py | 3 +++ ram/portal/templates/base.html | 12 ++++++------ ram/portal/templates/consist.html | 10 +++++----- ram/portal/templates/consists.html | 18 +++++++++--------- ram/portal/templates/home.html | 6 +++--- ram/portal/urls.py | 6 +++++- 7 files changed, 48 insertions(+), 24 deletions(-) create mode 100644 ram/consist/migrations/0002_alter_consist_options.py diff --git a/ram/consist/migrations/0002_alter_consist_options.py b/ram/consist/migrations/0002_alter_consist_options.py new file mode 100644 index 0000000..b3e5239 --- /dev/null +++ b/ram/consist/migrations/0002_alter_consist_options.py @@ -0,0 +1,17 @@ +# Generated by Django 4.0.6 on 2022-07-10 13:19 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('consist', '0001_initial'), + ] + + operations = [ + migrations.AlterModelOptions( + name='consist', + options={'ordering': ['creation_time']}, + ), + ] diff --git a/ram/consist/models.py b/ram/consist/models.py index cdd1085..3bf1d6d 100644 --- a/ram/consist/models.py +++ b/ram/consist/models.py @@ -27,6 +27,9 @@ class Consist(models.Model): def get_absolute_url(self): return reverse("consist", kwargs={"uuid": self.uuid}) + class Meta: + ordering = ["creation_time"] + class ConsistItem(models.Model): consist = models.ForeignKey( diff --git a/ram/portal/templates/base.html b/ram/portal/templates/base.html index ae063c0..7d16270 100644 --- a/ram/portal/templates/base.html +++ b/ram/portal/templates/base.html @@ -34,7 +34,7 @@