]> git.sommitrealweird.co.uk Git - sommitrealweird.git/blobdiff - sommitrealweird/photo/models.py
Fix 404 renderer
[sommitrealweird.git] / sommitrealweird / photo / models.py
index 1e2cc6842da83f4c41f3311d7f761dc1f0257209..3a5d123c8e5b134de54185093c7df7e92c28a5fd 100644 (file)
@@ -7,8 +7,11 @@ class Album(models.Model):
     slug = models.SlugField()
 
     def get_main_image(self):
     slug = models.SlugField()
 
     def get_main_image(self):
-        main_photo = Photo.objects.filter(album=self).order_by('order','image')[0]
-        return main_photo.image
+        try:
+            main_photo = Photo.objects.filter(album=self).order_by('order','image')[0]
+            return main_photo.image
+        except:
+            return None
 
     def __unicode__(self):
         return "%s" %(self.name,)
 
     def __unicode__(self):
         return "%s" %(self.name,)