소스 검색

Choices block in gallery

Arnar Tumi Þorsteinsson 8 년 전
부모
커밋
9d32c1437c
1개의 변경된 파일13개의 추가작업 그리고 9개의 파일을 삭제
  1. 13 9
      bakerydemo/base/models.py

+ 13 - 9
bakerydemo/base/models.py

@@ -111,21 +111,25 @@ class AboutPage(Page):
 
 def getImageCollections():
     # We return all collections to a list that don't have the name root.
-    return [(
-        collection.id, collection.name
-        ) for collection in Collection.objects.all().exclude(
-        name='Root'
-        )]
+    try:
+        collection_images = [(
+            collection.id, collection.name
+            ) for collection in Collection.objects.all().exclude(
+            name='Root'
+            )]
+        return collection_images
+    except:
+        return [('','')]
 
 
 class GalleryPage(Page):
     """
     This is a page to list all the locations on the site
     """
-    try:
-        CHOICES_LIST = getImageCollections()
-    except:
-        CHOICES_LIST = [("", "")]
+    # try:
+    CHOICES_LIST = getImageCollections()
+    # except:
+    #     CHOICES_LIST = [("", "")]
     # To return our collection choices for the editor to access we need to
     # make the choices list a variable rather than a function