-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #102 from shannonturner/v7.1
V7.1 - Eyedropper, Move Station, London, and 8 new station styles
- Loading branch information
Showing
29 changed files
with
2,151 additions
and
466 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,11 @@ All Maps Ever | |
|
||
Browse all of the 200,000 maps (and counting) in the library: [https://metromapmaker.com/calendar/](https://metromapmaker.com/calendar/) | ||
|
||
Development log | ||
---------------- | ||
|
||
See sneak previews, how development is progressing, when you can expect new releases, what new features I'm prioritizing and what I want to build next plus so much more at [blog.metromapmaker.com/](https://blog.metromapmaker.com/) | ||
|
||
Made something cool? | ||
--------------------- | ||
I'd love to see it! [Say hi!](mailto:[email protected]?subject=Metro+Map+Maker) | ||
|
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
54 changes: 54 additions & 0 deletions
54
metro_map_saver/map_saver/management/commands/oneoff_replace_ampamp.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,54 @@ | ||
from django.core.management.base import BaseCommand | ||
from map_saver.models import SavedMap | ||
|
||
class Command(BaseCommand): | ||
help = """ | ||
One-off script to fix the ~300 map names that have ampersands | ||
corrupted to & | ||
""" | ||
|
||
def add_arguments(self, parser): | ||
parser.add_argument( | ||
'-l', | ||
'--limit', | ||
type=int, | ||
dest='limit', | ||
default=1000, | ||
help='Only process this many maps at once.', | ||
) | ||
|
||
parser.add_argument( | ||
'--dry-run', | ||
action='store_true', | ||
dest='dry_run', | ||
default=False, | ||
help='Dry run to show which maps and replacements would occur, but do not actually change any maps.', | ||
) | ||
|
||
def handle(self, *args, **kwargs): | ||
limit = kwargs['limit'] | ||
dry_run = kwargs.get('dry_run') | ||
needs_editing = SavedMap.objects.filter(name__contains='&') | ||
count = needs_editing.count() | ||
|
||
replacements = [ | ||
'&' + ('amp;' * 5), | ||
'&' + ('amp;' * 4), | ||
'&' + ('amp;' * 3), | ||
'&' + ('amp;' * 2), | ||
'&' + ('amp;'), | ||
] | ||
|
||
for mmap in needs_editing[:limit]: | ||
|
||
new_name = mmap.name | ||
for replacement in replacements: | ||
new_name = new_name.replace(replacement, '&') | ||
|
||
if dry_run: | ||
print(f'Would rename {mmap.id} (from {mmap.name} to {new_name})') | ||
else: | ||
mmap.name = new_name | ||
mmap.save() | ||
|
||
self.stdout.write(f'{"Would replace" if dry_run else "Replaced"} & to ampersands in the name for {min(count, limit)} maps.') |
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
28 changes: 28 additions & 0 deletions
28
metro_map_saver/map_saver/migrations/0033_savedmap_browse_visible_and_more.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,28 @@ | ||
# Generated by Django 5.1.2 on 2024-11-28 03:25 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('map_saver', '0032_city_map_saver_c_name_f3a223_idx'), | ||
('taggit', '0006_rename_taggeditem_content_type_object_id_taggit_tagg_content_8fc721_idx'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='savedmap', | ||
name='browse_visible', | ||
field=models.BooleanField(default=True, help_text='Uncheck this to disable a map from being able to be browsed in the maps by date and similar views, though it is still accessible by direct link.'), | ||
), | ||
migrations.AlterField( | ||
model_name='savedmap', | ||
name='gallery_visible', | ||
field=models.BooleanField(default=True, help_text='Should this be shown in the default view of the Admin Gallery?'), | ||
), | ||
migrations.AddIndex( | ||
model_name='savedmap', | ||
index=models.Index(fields=['browse_visible'], name='map_saver_s_browse__add01f_idx'), | ||
), | ||
] |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.