瀏覽代碼

Rename choices to collection on Gallery page
- For clarity in admin UI
- Prevent gallery introduction from wrapping into images
- Toward #36

Scot Hacker 8 年之前
父節點
當前提交
3fd43d9ea1

+ 20 - 0
bakerydemo/base/migrations/0012_auto_20170222_0756.py

@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.5 on 2017-02-22 07:56
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('base', '0011_auto_20170220_0111'),
+    ]
+
+    operations = [
+        migrations.RenameField(
+            model_name='gallerypage',
+            old_name='choices',
+            new_name='collection',
+        ),
+    ]

+ 2 - 8
bakerydemo/base/models.py

@@ -201,7 +201,7 @@ class GalleryPage(BasePageFieldsMixin, Page):
     """
     This is a page to list locations from the selected Collection
     """
-    choices = models.ForeignKey(
+    collection = models.ForeignKey(
         Collection,
         limit_choices_to=~models.Q(name__in=['Root']),
         null=True,
@@ -211,20 +211,14 @@ class GalleryPage(BasePageFieldsMixin, Page):
     )
 
     content_panels = BasePageFieldsMixin.content_panels + [
-        FieldPanel('choices'),
+        FieldPanel('collection'),
     ]
 
-    # parent_page_types = [
-    #     'home.HomePage'
-    # ]
-
     # Defining what content type can sit under the parent. Since it's a blank
     # array no subpage can be added
     subpage_types = [
     ]
 
-    # api_fields = ['introduction']
-
 
 class FormField(AbstractFormField):
     page = ParentalKey('FormPage', related_name='form_fields')

+ 2 - 2
bakerydemo/templates/base/gallery_page.html

@@ -18,8 +18,8 @@
 <div class="container">
     <div class="row">
         <div class="col-xs-12">
-            {{ page.introduction }}
-            {% gallery page.choices %}
+            <h2>{{ page.introduction }}</h2>
+            {% gallery page.collection %}
         </div>
     </div>
 </div>