← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands-website/correct_migration into lp:widelands-website

 

kaputtnik has proposed merging lp:~widelands-dev/widelands-website/correct_migration into lp:widelands-website.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1608270 in Widelands Website: "One wrong migration / migrations files in general"
  https://bugs.launchpad.net/widelands-website/+bug/1608270

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands-website/correct_migration/+merge/302883

Correct the disturbing migration for wlmaps.

Since Django uses the migration files to detect changes, it should be save to change both, the model and the migration file.

If you think this is unsafe, we could only change the model, run "makemigrations" and "migrate". But this will make a new migration file which we will have to ship.

I wonder that Django makes migrations for such little changes, which are not relevant for the database. In this case the value for "upload_to" isn't stored in the database at all.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands-website/correct_migration into lp:widelands-website.
=== modified file 'wlmaps/migrations/0001_initial.py'
--- wlmaps/migrations/0001_initial.py	2016-06-13 19:05:19 +0000
+++ wlmaps/migrations/0001_initial.py	2016-08-14 12:58:09 +0000
@@ -25,8 +25,8 @@
                 ('nr_players', models.PositiveIntegerField(verbose_name=b'Max Players')),
                 ('descr', models.TextField(verbose_name=b'Description')),
                 ('hint', models.TextField(verbose_name=b'Hint')),
-                ('minimap', models.ImageField(upload_to=b'/home/kaputtnik/wl_django1_8/code/widelands/media//wlmaps/minimaps/', verbose_name=b'Minimap')),
-                ('file', models.FileField(upload_to=b'/home/kaputtnik/wl_django1_8/code/widelands/media//wlmaps/maps/', verbose_name=b'Mapfile')),
+                ('minimap', models.ImageField(upload_to=b'wlmaps/minimaps', verbose_name=b'Minimap')),
+                ('file', models.FileField(upload_to=b'wlmaps/maps', verbose_name=b'Mapfile')),
                 ('world_name', models.CharField(max_length=50)),
                 ('pub_date', models.DateTimeField(default=datetime.datetime.now)),
                 ('uploader_comment', models.TextField(verbose_name=b'Uploader comment', blank=True)),

=== modified file 'wlmaps/models.py'
--- wlmaps/models.py	2016-05-18 19:31:46 +0000
+++ wlmaps/models.py	2016-08-14 12:58:09 +0000
@@ -24,9 +24,9 @@
     descr = models.TextField(verbose_name='Description')
     hint = models.TextField(verbose_name='Hint')
     minimap = models.ImageField(
-        verbose_name='Minimap', upload_to=settings.MEDIA_ROOT + '/wlmaps/minimaps/')
+        verbose_name='Minimap', upload_to='wlmaps/minimaps')
     file = models.FileField(verbose_name='Mapfile',
-                            upload_to=settings.MEDIA_ROOT + '/wlmaps/maps/')
+                            upload_to='wlmaps/maps')
 
     world_name = models.CharField(max_length=50)
 


Follow ups