]> git.parisson.com Git - mezzo.git/commitdiff
Move Photo to core
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Fri, 19 Aug 2016 14:37:29 +0000 (16:37 +0200)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Fri, 19 Aug 2016 14:37:29 +0000 (16:37 +0200)
app/local_settings.py
app/organization/core/models.py
app/organization/festival/models.py
app/organization/magazine/models.py
app/organization/media/models.py
app/organization/team/models.py

index 8677ccaa5f7ba0020d697c118243093f0e6e1987..3f48283214ebf4cc895bee0bbd1f8dda0561dbb5 100644 (file)
@@ -70,7 +70,7 @@ SILENCED_SYSTEM_CHECKS = ['fields.W342',]
 
 ADMIN_MENU_ORDER = (
     (_('Pages'), ('pages.Page', 'organization-featured.Featured', 'organization-pages.Home')),
-    (_('Media'), ('organization-media.Video', 'organization-media.VideoCategory', 'organization-media.Audio', 'organization-media.Playlist',  'organization-media.Photo', (_('Media Library'), 'fb_browse'),)),
+    (_('Media'), ('organization-media.Video', 'organization-media.VideoCategory', 'organization-media.Audio', 'organization-media.Playlist', (_('Media Library'), 'fb_browse'),)),
     (_('Events'), ('mezzanine_agenda.Event', 'mezzanine_agenda.EventLocation', 'mezzanine_agenda.EventCategory', 'mezzanine_agenda.EventPrice',)),
     (_('Magazine'), ('organization-magazine.Article', 'organization-magazine.Brief',)),
     (_('Organization'), ('organization-team.Organization', 'organization-team.Department', 'organization-team.Team', 'organization-team.Person', 'organization-team.Activity', 'organization-team.OrganizationType',)),
index 118ddd463de185df7a92a3a58f0f15d043444c3c..1170ddaf60453d8c307227ed52f5cef5e403be51 100644 (file)
@@ -8,9 +8,10 @@ from django.contrib.contenttypes.fields import GenericForeignKey
 from mezzanine.pages.models import Page, RichText
 from mezzanine.core.fields import RichTextField, OrderField, FileField
 from mezzanine.core.models import Displayable, Slugged, Orderable
-from organization.media.models import Photo
+
 
 COLOR_CHOICES = (('black', _('black')), ('yellow', _('yellow')), ('red', _('red')))
+ALIGNMENT_CHOICES = (('left', _('left')), ('center', _('center')), ('right', _('right')))
 
 
 class Description(models.Model):
@@ -68,6 +69,32 @@ class Category(Named):
         return self.name
 
 
+class Photo(models.Model):
+    """Photo bundle with credits"""
+
+    photo = FileField(_('photo'), upload_to='images/photos', max_length=1024, blank=True, format="Image")
+    photo_credits = models.CharField(_('photo credits'), max_length=255, blank=True, null=True)
+    photo_alignment = models.CharField(_('photo alignment'), choices=ALIGNMENT_CHOICES, max_length=32, default="left", blank=True)
+    photo_description = models.TextField(_('photo description'), blank=True)
+
+    photo_card = FileField(_('card photo'), upload_to='images/photos/card', max_length=1024, blank=True, format="Image")
+    photo_card_credits = models.CharField(_('photo card credits'), max_length=255, blank=True, null=True)
+
+    photo_slider = FileField(_('slider photo'), upload_to='images/photos/slider', max_length=1024, blank=True, format="Image")
+    photo_slider_credits = models.CharField(_('photo slider credits'), max_length=255, blank=True, null=True)
+    abstract = True
+
+    class Meta:
+        abstract = True
+
+    @property
+    def card(self):
+        if self.photo_card:
+            return self.photo_card
+        else:
+            return self.photo
+
+
 class BasicPage(Page, SubTitle, Photo, RichText):
 
     class Meta:
@@ -106,6 +133,7 @@ class DynamicContent(models.Model):
     class Meta:
         abstract = True
 
+
 class Image(Description, Orderable):
 
     file = FileField(_("Image"), max_length=1024, format="Image", upload_to="images")
index 430ac4bf6eb758044b1bce41f16aa3570573ed38..5b110a40f82bdb1573d98c7af58bb21c84047a3d 100644 (file)
@@ -10,7 +10,6 @@ from mezzanine.blog.models import BlogPost
 from mezzanine.pages.models import Page
 
 from organization.core.models import *
-from organization.media.models import *
 
 import requests
 from pyquery import PyQuery as pq
index 01595dca553dc228cff73a9f94f46e50da79f86f..a5e02f11b5b46ebd947570f7cda6ef9f5089654b 100644 (file)
@@ -11,8 +11,7 @@ from mezzanine.core.models import RichText, Displayable, Slugged
 from mezzanine.pages.models import Page
 from mezzanine.blog.models import BlogPost
 #from orderable.models import Orderable
-from organization.core.models import Named, Description, Image
-from organization.media.models import Photo
+from organization.core.models import Named, Description, Image, Photo
 
 class ArticleImage(Image):
 
index a85187c2e4f904ad4b98283c8834be4e8f2c0158..d13c8a6d17c663410d21789421b5efc188d000bc 100644 (file)
@@ -10,33 +10,8 @@ from mezzanine.utils.models import AdminThumbMixin, upload_to
 from mezzanine_agenda.models import Event
 from django.conf import settings
 
-ALIGNMENT_CHOICES = (('left', _('left')), ('center', _('center')), ('right', _('right')))
-MEDIA_BASE_URL = getattr(settings, 'MEDIA_BASE_URL', 'http://medias.ircam.fr/embed/media/')
-
-
-class Photo(models.Model):
-    """Photo bundle with credits"""
-
-    photo = FileField(_('photo'), upload_to='images/photos', max_length=1024, blank=True, format="Image")
-    photo_credits = models.CharField(_('photo credits'), max_length=255, blank=True, null=True)
-    photo_alignment = models.CharField(_('photo alignment'), choices=ALIGNMENT_CHOICES, max_length=32, default="left", blank=True)
-    photo_description = models.TextField(_('photo description'), blank=True)
-
-    photo_card = FileField(_('card photo'), upload_to='images/photos/card', max_length=1024, blank=True, format="Image")
-    photo_card_credits = models.CharField(_('photo card credits'), max_length=255, blank=True, null=True)
-
-    photo_slider = FileField(_('slider photo'), upload_to='images/photos/slider', max_length=1024, blank=True, format="Image")
-    photo_slider_credits = models.CharField(_('photo slider credits'), max_length=255, blank=True, null=True)
 
-    class Meta:
-        abstract = True
-
-    @property
-    def card(self):
-        if self.photo_card:
-            return self.photo_card
-        else:
-            return self.photo
+MEDIA_BASE_URL = getattr(settings, 'MEDIA_BASE_URL', 'http://medias.ircam.fr/embed/media/')
 
 
 class Media(Displayable, RichText):
index b8eec8600f5d6091133e5418d62c70088874b6fe..dfd653c8548f7865614e1616e1b7bf51eebb22fa 100644 (file)
@@ -21,7 +21,6 @@ from mezzanine.core.fields import RichTextField, OrderField, FileField
 from mezzanine.utils.models import AdminThumbMixin, upload_to
 from mezzanine.galleries.models import BaseGallery
 
-from organization.media.models import Photo
 from organization.core.models import *
 from organization.magazine.models import Article