-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a 404 page and improve manufacturer lookup (#36)
* Add a custom 404 page * Better manufacturer and item lookup * Add migration to populate new field * Version bump
- Loading branch information
Showing
7 changed files
with
69 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from ram.utils import git_suffix | ||
|
||
__version__ = "0.12.2" | ||
__version__ = "0.12.3" | ||
__version__ += git_suffix(__file__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
ram/roster/migrations/0026_rollingstock_item_number_slug.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Generated by Django 5.0.4 on 2024-04-23 21:10 | ||
|
||
from django.db import migrations, models | ||
from ram.utils import slugify | ||
|
||
|
||
def gen_item_number_slug(apps, schema_editor): | ||
RollingStock = apps.get_model('roster', 'RollingStock') | ||
for row in RollingStock.objects.all(): | ||
if row.item_number: | ||
row.item_number_slug = slugify(row.item_number) | ||
row.save(update_fields=['item_number_slug']) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("roster", "0025_rollingstock_set_alter_rollingstock_era_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="rollingstock", | ||
name="item_number_slug", | ||
field=models.CharField(blank=True, editable=False, max_length=32), | ||
), | ||
migrations.RunPython( | ||
gen_item_number_slug, | ||
reverse_code=migrations.RunPython.noop | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters