← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands-website/bug-1750102_map_admin_page into lp:widelands-website

 

kaputtnik has proposed merging lp:~widelands-dev/widelands-website/bug-1750102_map_admin_page into lp:widelands-website.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1750102 in Widelands Website: "Allow map editing without world name"
  https://bugs.launchpad.net/widelands-website/+bug/1750102

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands-website/bug-1750102_map_admin_page/+merge/338767

Allow some columns of table wlmaps_map to be empty. This makes renaming a map possible.

Also reworked the admin page of wlmaps and split into some sections.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands-website/bug-1750102_map_admin_page into lp:widelands-website.
=== modified file 'wlmaps/admin.py'
--- wlmaps/admin.py	2016-02-09 18:05:18 +0000
+++ wlmaps/admin.py	2018-02-23 09:36:54 +0000
@@ -7,9 +7,24 @@
 
 
 class MapAdmin(admin.ModelAdmin):
+    list_display = ['name', 'author', 'pub_date']
     prepopulated_fields = {'slug': ('name',)}
     search_fields = ['name', 'author']
-    list_display = ['name', 'author', 'pub_date']
     list_filter = ['pub_date']
-
+    readonly_fields = ('uploader', 'nr_players', 'w', 'h', 'minimap', 'file', 'world_name')
+    fieldsets = (
+        (None, {
+            'fields': (('name', 'author'), 'uploader', 'uploader_comment')
+        }),
+        ('Map properties', {
+            'classes': ('collapse',),
+            'fields': ('descr', 'hint', 'world_name',
+                       ('nr_players', 'w', 'h')
+                       )
+        }),
+        ('Upload information', {
+            'classes': ('collapse',),
+            'fields': ('minimap', 'file', 'pub_date', 'nr_downloads', 'slug')
+        }),
+    )
 admin.site.register(Map, MapAdmin)

=== modified file 'wlmaps/models.py'
--- wlmaps/models.py	2018-01-14 10:37:20 +0000
+++ wlmaps/models.py	2018-02-23 09:36:54 +0000
@@ -22,13 +22,13 @@
     nr_players = models.PositiveIntegerField(verbose_name='Max Players')
 
     descr = models.TextField(verbose_name='Description')
-    hint = models.TextField(verbose_name='Hint')
+    hint = models.TextField(verbose_name='Hint', blank=True)
     minimap = models.ImageField(
         verbose_name='Minimap', upload_to='wlmaps/minimaps')
     file = models.FileField(verbose_name='Mapfile',
                             upload_to='wlmaps/maps')
 
-    world_name = models.CharField(max_length=50)
+    world_name = models.CharField(max_length=50, blank=True)
 
     pub_date = models.DateTimeField(default=datetime.datetime.now)
     uploader_comment = models.TextField(


Follow ups