Rename feed field

This commit is contained in:
Emmy D'Anello 2024-01-27 15:18:33 +01:00
parent 119d0bf635
commit b6da0c54f7
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
4 changed files with 42 additions and 29 deletions

View File

@ -75,8 +75,8 @@ class TransferAdmin(admin.ModelAdmin):
@admin.register(FeedInfo) @admin.register(FeedInfo)
class FeedInfoAdmin(admin.ModelAdmin): class FeedInfoAdmin(admin.ModelAdmin):
list_display = ('feed_publisher_name', 'feed_publisher_url', 'feed_lang', 'feed_start_date', list_display = ('publisher_name', 'publisher_url', 'lang', 'start_date',
'feed_end_date', 'feed_version',) 'end_date', 'version',)
search_fields = ('feed_publisher_name', 'feed_publisher_url', 'feed_lang', 'feed_start_date', search_fields = ('publisher_name', 'publisher_url', 'lang', 'start_date',
'feed_end_date', 'feed_version',) 'end_date', 'version',)
ordering = ('feed_publisher_name',) ordering = ('publisher_name',)

View File

@ -325,12 +325,12 @@ class Command(BaseCommand):
for feed_info_dict in csv.DictReader(zipfile.read("feed_info.txt").decode().splitlines()): for feed_info_dict in csv.DictReader(zipfile.read("feed_info.txt").decode().splitlines()):
feed_info_dict: dict feed_info_dict: dict
FeedInfo.objects.update_or_create( FeedInfo.objects.update_or_create(
feed_publisher_name=feed_info_dict['feed_publisher_name'], publisher_name=feed_info_dict['feed_publisher_name'],
defaults={ defaults=dict(
'feed_publisher_url': feed_info_dict['feed_publisher_url'], publisher_url=feed_info_dict['feed_publisher_url'],
'feed_lang': feed_info_dict['feed_lang'], lang=feed_info_dict['feed_lang'],
'feed_start_date': feed_info_dict['feed_start_date'], start_date=feed_info_dict['feed_start_date'],
'feed_end_date': feed_info_dict['feed_end_date'], end_date=feed_info_dict['feed_end_date'],
'feed_version': feed_info_dict['feed_version'], version=feed_info_dict['feed_version'],
} )
) )

View File

@ -1,4 +1,4 @@
# Generated by Django 5.0.1 on 2024-01-27 10:29 # Generated by Django 5.0.1 on 2024-01-27 14:08
import django.db.models.deletion import django.db.models.deletion
from django.db import migrations, models from django.db import migrations, models
@ -55,6 +55,7 @@ class Migration(migrations.Migration):
options={ options={
"verbose_name": "Agency", "verbose_name": "Agency",
"verbose_name_plural": "Agencies", "verbose_name_plural": "Agencies",
"ordering": ("name",),
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
@ -95,6 +96,7 @@ class Migration(migrations.Migration):
options={ options={
"verbose_name": "Calendar", "verbose_name": "Calendar",
"verbose_name_plural": "Calendars", "verbose_name_plural": "Calendars",
"ordering": ("id",),
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
@ -110,29 +112,27 @@ class Migration(migrations.Migration):
), ),
), ),
( (
"feed_publisher_name", "publisher_name",
models.CharField( models.CharField(
max_length=255, verbose_name="Feed publisher name" max_length=255, verbose_name="Feed publisher name"
), ),
), ),
("publisher_url", models.URLField(verbose_name="Feed publisher URL")),
( (
"feed_publisher_url", "lang",
models.URLField(verbose_name="Feed publisher URL"),
),
(
"feed_lang",
models.CharField(max_length=255, verbose_name="Feed language"), models.CharField(max_length=255, verbose_name="Feed language"),
), ),
("feed_start_date", models.DateField(verbose_name="Feed start date")), ("start_date", models.DateField(verbose_name="Feed start date")),
("feed_end_date", models.DateField(verbose_name="Feed end date")), ("end_date", models.DateField(verbose_name="Feed end date")),
( (
"feed_version", "version",
models.CharField(max_length=255, verbose_name="Feed version"), models.CharField(max_length=255, verbose_name="Feed version"),
), ),
], ],
options={ options={
"verbose_name": "Feed info", "verbose_name": "Feed info",
"verbose_name_plural": "Feed infos", "verbose_name_plural": "Feed infos",
"ordering": ("publisher_name",),
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
@ -181,6 +181,7 @@ class Migration(migrations.Migration):
options={ options={
"verbose_name": "Calendar date", "verbose_name": "Calendar date",
"verbose_name_plural": "Calendar dates", "verbose_name_plural": "Calendar dates",
"ordering": ("id",),
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
@ -251,6 +252,7 @@ class Migration(migrations.Migration):
options={ options={
"verbose_name": "Route", "verbose_name": "Route",
"verbose_name_plural": "Routes", "verbose_name_plural": "Routes",
"ordering": ("id",),
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
@ -343,6 +345,7 @@ class Migration(migrations.Migration):
options={ options={
"verbose_name": "Stop", "verbose_name": "Stop",
"verbose_name_plural": "Stops", "verbose_name_plural": "Stops",
"ordering": ("id",),
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
@ -398,6 +401,7 @@ class Migration(migrations.Migration):
options={ options={
"verbose_name": "Transfer", "verbose_name": "Transfer",
"verbose_name_plural": "Transfers", "verbose_name_plural": "Transfers",
"ordering": ("id",),
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
@ -492,6 +496,7 @@ class Migration(migrations.Migration):
options={ options={
"verbose_name": "Trip", "verbose_name": "Trip",
"verbose_name_plural": "Trips", "verbose_name_plural": "Trips",
"ordering": ("id",),
}, },
), ),
migrations.CreateModel( migrations.CreateModel(

View File

@ -103,6 +103,7 @@ class Agency(models.Model):
class Meta: class Meta:
verbose_name = _("Agency") verbose_name = _("Agency")
verbose_name_plural = _("Agencies") verbose_name_plural = _("Agencies")
ordering = ("name",)
class Stop(models.Model): class Stop(models.Model):
@ -194,6 +195,7 @@ class Stop(models.Model):
class Meta: class Meta:
verbose_name = _("Stop") verbose_name = _("Stop")
verbose_name_plural = _("Stops") verbose_name_plural = _("Stops")
ordering = ("id",)
class Route(models.Model): class Route(models.Model):
@ -254,6 +256,7 @@ class Route(models.Model):
class Meta: class Meta:
verbose_name = _("Route") verbose_name = _("Route")
verbose_name_plural = _("Routes") verbose_name_plural = _("Routes")
ordering = ("id",)
class Trip(models.Model): class Trip(models.Model):
@ -376,6 +379,7 @@ class Trip(models.Model):
class Meta: class Meta:
verbose_name = _("Trip") verbose_name = _("Trip")
verbose_name_plural = _("Trips") verbose_name_plural = _("Trips")
ordering = ("id",)
class StopTime(models.Model): class StopTime(models.Model):
@ -514,6 +518,7 @@ class Calendar(models.Model):
class Meta: class Meta:
verbose_name = _("Calendar") verbose_name = _("Calendar")
verbose_name_plural = _("Calendars") verbose_name_plural = _("Calendars")
ordering = ("id",)
class CalendarDate(models.Model): class CalendarDate(models.Model):
@ -551,6 +556,7 @@ class CalendarDate(models.Model):
class Meta: class Meta:
verbose_name = _("Calendar date") verbose_name = _("Calendar date")
verbose_name_plural = _("Calendar dates") verbose_name_plural = _("Calendar dates")
ordering = ("id",)
class Transfer(models.Model): class Transfer(models.Model):
@ -588,32 +594,33 @@ class Transfer(models.Model):
class Meta: class Meta:
verbose_name = _("Transfer") verbose_name = _("Transfer")
verbose_name_plural = _("Transfers") verbose_name_plural = _("Transfers")
ordering = ("id",)
class FeedInfo(models.Model): class FeedInfo(models.Model):
feed_publisher_name = models.CharField( publisher_name = models.CharField(
max_length=255, max_length=255,
verbose_name=_("Feed publisher name"), verbose_name=_("Feed publisher name"),
) )
feed_publisher_url = models.URLField( publisher_url = models.URLField(
verbose_name=_("Feed publisher URL"), verbose_name=_("Feed publisher URL"),
) )
feed_lang = models.CharField( lang = models.CharField(
max_length=255, max_length=255,
verbose_name=_("Feed language"), verbose_name=_("Feed language"),
) )
feed_start_date = models.DateField( start_date = models.DateField(
verbose_name=_("Feed start date"), verbose_name=_("Feed start date"),
) )
feed_end_date = models.DateField( end_date = models.DateField(
verbose_name=_("Feed end date"), verbose_name=_("Feed end date"),
) )
feed_version = models.CharField( version = models.CharField(
max_length=255, max_length=255,
verbose_name=_("Feed version"), verbose_name=_("Feed version"),
) )
@ -621,3 +628,4 @@ class FeedInfo(models.Model):
class Meta: class Meta:
verbose_name = _("Feed info") verbose_name = _("Feed info")
verbose_name_plural = _("Feed infos") verbose_name_plural = _("Feed infos")
ordering = ("publisher_name",)