Merge lp:~widelands-dev/widelands-website/move_maps_minimap into lp:widelands-website
| Status: | Merged | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Merged at revision: | 545 | ||||||||
| Proposed branch: | lp:~widelands-dev/widelands-website/move_maps_minimap | ||||||||
| Merge into: | lp:widelands-website | ||||||||
| Diff against target: |
247 lines (+124/-22) 7 files modified
wlmaps/admin.py (+13/-1) wlmaps/forms.py (+15/-6) wlmaps/migrations/0003_auto_20190712_0928.py (+65/-0) wlmaps/models.py (+16/-1) wlmaps/templates/wlmaps/index.html (+3/-7) wlmaps/templates/wlmaps/inlines/version_info.html (+11/-0) wlmaps/templates/wlmaps/map_detail.html (+1/-7) |
||||||||
| To merge this branch: | bzr merge lp:~widelands-dev/widelands-website/move_maps_minimap | ||||||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| kaputtnik (community) | Needs Resubmitting | ||
| GunChleoc | Approve | ||
|
Review via email:
|
|||
Commit message
Move minimaps to wlmaps/minimaps
Implemented the new value needs_version_after
Delete map files (.wmf and .png) when deleting a map from the database
Description of the change
The maps minimaps are now moved to wlmaps/minimaps. This fixes also creating a faulty path in the database for the minimaps (beginning with a slash).
Deleting a map does now delete the related files.
The new value of 'needs_
The changes related to minimaps need manual intervention regarding the files and the database entries:
- All png files in MEDIA_ROOT/
- Database entries for minimaps need to be changed from
'/wlmaps/
to
'wlmaps/
To get this in:
- set maintenance
- backup the database
- backup the files from MEDIA_ROOT/wlmaps/
- run ./manage.py migrate
- move the png files
- correct the path(s) in the database. I want to change also some bad entries for the mapfiles. With activated virtualenvironment:
./manage.py shell
from wlmaps.models import Map
maps = Map.objects.all()
for m in maps:
if m.minimap.
new_name = m.minimap.
m.minimap = 'wlmaps/
m.save()
maps = Map.objects.all()
for m in maps:
if m.file.
new_name = m.file.
m.file = 'wlmaps/
m.save()
This can maybe done also in one loop (changing minimap and file), but i fear saving an object twice in one loop can be problematic, although at home it works nicely.

LGTM :)