]> git.parisson.com Git - mezzo.git/commitdiff
Task #59: Basic Page - adding image
authorEmilie <zawadzki@ircam.fr>
Tue, 5 Jul 2016 16:28:35 +0000 (18:28 +0200)
committerEmilie <zawadzki@ircam.fr>
Tue, 5 Jul 2016 16:28:35 +0000 (18:28 +0200)
app/custom/migrations/0003_auto_20160705_1702.py [new file with mode: 0644]
app/custom/migrations/0004_auto_20160705_1810.py [new file with mode: 0644]
app/custom/models.py
app/custom/translations.py

diff --git a/app/custom/migrations/0003_auto_20160705_1702.py b/app/custom/migrations/0003_auto_20160705_1702.py
new file mode 100644 (file)
index 0000000..260418e
--- /dev/null
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-07-05 15:02
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('custom', '0002_auto_20160705_1559'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='basicpage',
+            name='sub_title',
+            field=models.CharField(blank=True, max_length=1000, verbose_name='sub title'),
+        ),
+        migrations.AlterField(
+            model_name='basicpage',
+            name='sub_title_en',
+            field=models.CharField(blank=True, max_length=1000, null=True, verbose_name='sub title'),
+        ),
+        migrations.AlterField(
+            model_name='basicpage',
+            name='sub_title_fr',
+            field=models.CharField(blank=True, max_length=1000, null=True, verbose_name='sub title'),
+        ),
+    ]
diff --git a/app/custom/migrations/0004_auto_20160705_1810.py b/app/custom/migrations/0004_auto_20160705_1810.py
new file mode 100644 (file)
index 0000000..d3e93e9
--- /dev/null
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-07-05 16:10
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import mezzanine.core.fields
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('custom', '0003_auto_20160705_1702'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='basicpage',
+            name='photo',
+            field=mezzanine.core.fields.FileField(blank=True, max_length=1024, verbose_name='photo'),
+        ),
+        migrations.AddField(
+            model_name='basicpage',
+            name='photo_alignment',
+            field=models.CharField(blank=True, choices=[('left', 'left'), ('right', 'right')], default='left', max_length=32, verbose_name='photo alignment'),
+        ),
+        migrations.AddField(
+            model_name='basicpage',
+            name='photo_credits',
+            field=models.CharField(blank=True, max_length=255, null=True, verbose_name='photo credits'),
+        ),
+        migrations.AddField(
+            model_name='basicpage',
+            name='photo_description',
+            field=models.TextField(blank=True, verbose_name='photo description'),
+        ),
+        migrations.AddField(
+            model_name='basicpage',
+            name='photo_featured',
+            field=mezzanine.core.fields.FileField(blank=True, max_length=1024, verbose_name='photo featured'),
+        ),
+        migrations.AddField(
+            model_name='basicpage',
+            name='photo_featured_credits',
+            field=models.CharField(blank=True, max_length=255, null=True, verbose_name='photo featured credits'),
+        ),
+    ]
index 5be18acc6984d6ab0e87c07c83885b71449cc5da..32dceb47cde9d52776eac12fee840741d3e2cfbc 100644 (file)
@@ -1,13 +1,10 @@
 from django.db import models
 from django.utils.translation import ugettext_lazy as _
 from django.core.urlresolvers import reverse, reverse_lazy
-#from mezzanine.core.models import Displayable
 from mezzanine.pages.models import Page, RichText
-# Create your models here.
-# class DisplayableCustom(Displayable):
-#
-#     sub_title = models.TextField(_('sub_title'), blank=True)
+from mezzanine.core.fields import RichTextField, OrderField, FileField
 
+ALIGNMENT_CHOICES = (('left', _('left')), ('right', _('right')))
 
 class SubTitle(models.Model):
 
@@ -19,4 +16,11 @@ class SubTitle(models.Model):
 
 class BasicPage(Page, RichText):
 
-    sub_title = models.TextField(_('sub title'), blank=True)
+    sub_title = models.CharField(_('sub title'), blank=True, max_length=1000)
+    # description = models.TextField(_('description'), blank=True)
+    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_featured = FileField(_('photo featured'), upload_to='images/photos', max_length=1024, blank=True, format="Image")
+    photo_featured_credits = models.CharField(_('photo featured credits'), max_length=255, blank=True, null=True)
index bd3f3db3ae052f3150a362ccd10dc966586a7756..1d0d1bc9f7d67c2404ff0bd06dafdf1027894a89 100644 (file)
@@ -1,24 +1,3 @@
-# from modeltranslation.translator import translator, register, TranslationOptions
-# from mezzanine.pages.models import Page, RichTextPage, Link
-# from mezzanine.pages.translation import TranslatedRichText
-# from mezzanine.forms.models import Form
-# from mezzanine.galleries.models import Gallery
-#
-# # @register(RichText)
-# # class RichTextTranslationOptions(TranslatedRichText):
-# #
-# #     fields = ('sub_title')
-#
-# # print(RichTextPage._meta.get_fields())
-# # print('///////////////////////////')
-# class TranslatedInjectedRichText(TranslatedRichText):
-#     fields = ('sub_title',)
-#
-# translator.unregister(RichTextPage)
-#
-# translator.register(RichTextPage, TranslatedInjectedRichText)
-
-
 from modeltranslation.translator import translator, register, TranslationOptions
 from mezzanine.pages.models import Page, RichText
 from mezzanine.pages.translation import TranslatedRichText