]> git.parisson.com Git - mezzo.git/commitdiff
Task #73: adding article content type
authorEmilie <zawadzki@ircam.fr>
Thu, 7 Jul 2016 09:35:46 +0000 (11:35 +0200)
committerEmilie <zawadzki@ircam.fr>
Thu, 7 Jul 2016 09:35:46 +0000 (11:35 +0200)
23 files changed:
app/custom/admin.py
app/custom/migrations/0005_auto_20160706_1803.py [new file with mode: 0644]
app/custom/migrations/0006_auto_20160706_1839.py [new file with mode: 0644]
app/custom/migrations/0007_auto_20160706_1841.py [new file with mode: 0644]
app/custom/migrations/0008_auto_20160707_1047.py [new file with mode: 0644]
app/custom/models.py
app/custom/translations.py
app/local_settings.py
app/magazine/admin.py
app/magazine/migrations/0001_initial.py [new file with mode: 0644]
app/magazine/migrations/0002_article_sub_title.py [new file with mode: 0644]
app/magazine/migrations/0003_auto_20160706_1810.py [new file with mode: 0644]
app/magazine/migrations/0004_auto_20160706_1820.py [new file with mode: 0644]
app/magazine/migrations/0005_auto_20160706_1831.py [new file with mode: 0644]
app/magazine/migrations/0006_auto_20160706_1839.py [new file with mode: 0644]
app/magazine/migrations/0007_auto_20160706_1841.py [new file with mode: 0644]
app/magazine/migrations/0008_auto_20160706_1852.py [new file with mode: 0644]
app/magazine/migrations/0009_auto_20160707_1047.py [new file with mode: 0644]
app/magazine/migrations/0010_auto_20160707_1115.py [new file with mode: 0644]
app/magazine/migrations/0011_auto_20160707_1125.py [new file with mode: 0644]
app/magazine/models.py
app/magazine/translations.py [new file with mode: 0644]
app/settings.py

index 7ca39c30ffe5d97b460800ec1986e74bf6c2dd64..c31ded9b6de3a8eb791bab118fb75cbf770f13ff 100644 (file)
@@ -3,16 +3,22 @@ from copy import deepcopy
 from mezzanine.pages.models import Page
 from mezzanine.pages.admin import PageAdmin
 from mezzanine.pages.models import RichTextPage
+from mezzanine.core.admin import DisplayableAdmin
 from custom.models import BasicPage
 
 
-# page_fieldsets = deepcopy(PageAdmin.fieldsets)
-# page_fieldsets[0][1]["fields"] += ("sub_title",)
-# print(page_fieldsets[0][1]["fields"])
-# PageAdmin.fieldsets = page_fieldsets
+# class SubTitleAdmin(DisplayableAdmin):
+#          """
+#          Admin class for blog posts.
+#              return False
+
+#admin.site.register(SubTitle, DisplayableAdmin)
+
+
+# class SubTitleAdmin(admin.ModelAdmin):
 #
-# admin.site.unregister(RichTextPage)
-# admin.site.register(RichTextPage, PageAdmin)
+#     model = SubTitle
+
 
 
 admin.site.register(BasicPage, PageAdmin)
diff --git a/app/custom/migrations/0005_auto_20160706_1803.py b/app/custom/migrations/0005_auto_20160706_1803.py
new file mode 100644 (file)
index 0000000..13527ba
--- /dev/null
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-07-06 16:03
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('custom', '0004_auto_20160705_1810'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='basicpage',
+            name='sub_title',
+            field=models.TextField(blank=True, max_length=1000, verbose_name='sub title'),
+        ),
+        migrations.AlterField(
+            model_name='basicpage',
+            name='sub_title_en',
+            field=models.TextField(blank=True, max_length=1000, null=True, verbose_name='sub title'),
+        ),
+        migrations.AlterField(
+            model_name='basicpage',
+            name='sub_title_fr',
+            field=models.TextField(blank=True, max_length=1000, null=True, verbose_name='sub title'),
+        ),
+    ]
diff --git a/app/custom/migrations/0006_auto_20160706_1839.py b/app/custom/migrations/0006_auto_20160706_1839.py
new file mode 100644 (file)
index 0000000..c8422e8
--- /dev/null
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-07-06 16:39
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('custom', '0005_auto_20160706_1803'),
+    ]
+
+    operations = [
+        migrations.RemoveField(
+            model_name='basicpage',
+            name='sub_title_en',
+        ),
+        migrations.RemoveField(
+            model_name='basicpage',
+            name='sub_title_fr',
+        ),
+    ]
diff --git a/app/custom/migrations/0007_auto_20160706_1841.py b/app/custom/migrations/0007_auto_20160706_1841.py
new file mode 100644 (file)
index 0000000..38bd79b
--- /dev/null
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-07-06 16:41
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('custom', '0006_auto_20160706_1839'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='basicpage',
+            name='sub_title_en',
+            field=models.TextField(blank=True, max_length=1000, null=True, verbose_name='sub title'),
+        ),
+        migrations.AddField(
+            model_name='basicpage',
+            name='sub_title_fr',
+            field=models.TextField(blank=True, max_length=1000, null=True, verbose_name='sub title'),
+        ),
+    ]
diff --git a/app/custom/migrations/0008_auto_20160707_1047.py b/app/custom/migrations/0008_auto_20160707_1047.py
new file mode 100644 (file)
index 0000000..a781714
--- /dev/null
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-07-07 08:47
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('custom', '0007_auto_20160706_1841'),
+    ]
+
+    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'),
+        ),
+    ]
index fb186b1982ae22cd2c9e8615edfe703fd38968e1..922db29357524c47d3e8d78189ee709316beede5 100644 (file)
@@ -5,15 +5,15 @@ from mezzanine.pages.models import Page, RichText
 from mezzanine.core.fields import RichTextField, OrderField, FileField
 from django.conf import settings
 
+
 ALIGNMENT_CHOICES = (('left', _('left')), ('right', _('right')))
 MEDIA_BASE_URL = getattr(settings, 'MEDIA_BASE_URL', 'http://medias.ircam.fr/embed/media/')
 
-class SubTitle(models.Model):
-
-    sub_title = models.TextField(_('sub title'), blank=True)
-
-    class Meta:
-        abstract = True
+# class SubTitle(models.Model):
+#
+#     sub_title = models.TextField(_('sub title'), blank=True, max_length=1000)
+#     class Meta:
+#         abstract = True
 
 
 class BasicPage(Page, RichText):
index cbc624c84ef2b950ae00915fc7cfbfde548f564c..ee0ca35d6cd074a4f76f9ee652141ca167e86e8b 100644 (file)
@@ -3,6 +3,10 @@ from mezzanine.pages.models import Page, RichText
 from mezzanine.pages.translation import TranslatedRichText
 from custom.models import BasicPage
 
+# @register(SubTitle)
+# class SubTitleTranslationOptions(TranslationOptions):
+#
+#     fields = ('sub_title',)
 
 @register(BasicPage)
 class BasicPageTranslationOptions(TranslationOptions):
index 5b6f5d61a08e9c4be1ed95ae0426f4fcf50c3e02..6a46b456f905681995dfe7ae03e1ea483ea5ca5f 100644 (file)
@@ -78,10 +78,12 @@ SITE_TAGLINE = 'Festival 2 juin | 2 juillet 2016'
 SILENCED_SYSTEM_CHECKS = ['fields.W342',]
 
 ADMIN_MENU_ORDER = (
-    (_("Content"), ("pages.Page", "blog.BlogPost", "mezzanine_agenda.Event",
+    (_("Content"), ("pages.Page", "mezzanine_agenda.Event",
         "festival.Artist", "festival.Video", "festival.Audio", "festival.Playlist",
         "festival.Featured",
         "generic.ThreadedComment", (_("Media Library"), "fb_browse"),)),
+
+    (_("Magazine"), ("magazine.Article",)),
     (_("Site"), ("sites.Site", "redirects.Redirect", "conf.Setting")),
     (_("Users"), ("auth.User", "auth.Group",)),
     (_("Festival"), ("mezzanine_agenda.EventLocation",
@@ -137,3 +139,6 @@ DEBUG_TOOLBAR_PANELS = [
     'debug_toolbar.panels.logging.LoggingPanel',
     'debug_toolbar.panels.redirects.RedirectsPanel',
 ]
+
+# slug
+BLOG_SLUG = 'article'
index 8c38f3f3dad51e4585f3984282c2a4bec5349c1e..1ea6c2ff55ae4ae4f5cda73ef6b0dbe7d4373046 100644 (file)
@@ -1,3 +1,25 @@
 from django.contrib import admin
+from mezzanine.blog.admin import BlogPostAdmin
+from magazine.models import Article
+#from custom.admin import SubTitleAdmin
+from copy import deepcopy
 
-# Register your models here.
+from django.contrib import admin
+from django.utils.translation import ugettext_lazy as _
+from mezzanine.core.admin import DisplayableAdmin, OwnableAdmin
+
+# class ArticleAdmin(BlogPostAdmin, SubTitleAdmin):
+#
+#     model = Article
+
+#admin.site.register(Article, BlogPostAdmin)
+class ArticleAdmin(admin.ModelAdmin):
+
+    model = Article
+
+
+class ArticleAdminDisplayable(DisplayableAdmin):
+
+    fieldsets = deepcopy(ArticleAdmin.fieldsets)
+
+admin.site.register(Article, ArticleAdminDisplayable)
diff --git a/app/magazine/migrations/0001_initial.py b/app/magazine/migrations/0001_initial.py
new file mode 100644 (file)
index 0000000..bf9fec8
--- /dev/null
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-07-06 15:50
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+    initial = True
+
+    dependencies = [
+        ('blog', '0003_auto_20151223_1313'),
+    ]
+
+    operations = [
+        migrations.CreateModel(
+            name='Article',
+            fields=[
+                ('blogpost_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='blog.BlogPost')),
+            ],
+            options={
+                'abstract': False,
+            },
+            bases=('blog.blogpost',),
+        ),
+        migrations.CreateModel(
+            name='Category',
+            fields=[
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('name', models.CharField(max_length=512, verbose_name='name')),
+                ('description', models.TextField(blank=True, verbose_name='description')),
+            ],
+            options={
+                'verbose_name': 'category',
+            },
+        ),
+        migrations.CreateModel(
+            name='Topic',
+            fields=[
+                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+                ('name', models.CharField(max_length=512, verbose_name='name')),
+                ('description', models.TextField(blank=True, verbose_name='description')),
+            ],
+            options={
+                'verbose_name': 'topic',
+            },
+        ),
+    ]
diff --git a/app/magazine/migrations/0002_article_sub_title.py b/app/magazine/migrations/0002_article_sub_title.py
new file mode 100644 (file)
index 0000000..7cf3922
--- /dev/null
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-07-06 16:07
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('magazine', '0001_initial'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='article',
+            name='sub_title',
+            field=models.TextField(blank=True, max_length=1000, verbose_name='sub title'),
+        ),
+    ]
diff --git a/app/magazine/migrations/0003_auto_20160706_1810.py b/app/magazine/migrations/0003_auto_20160706_1810.py
new file mode 100644 (file)
index 0000000..8085487
--- /dev/null
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-07-06 16:10
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('magazine', '0002_article_sub_title'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='article',
+            name='sub_title_en',
+            field=models.TextField(blank=True, max_length=1000, null=True, verbose_name='sub title'),
+        ),
+        migrations.AddField(
+            model_name='article',
+            name='sub_title_fr',
+            field=models.TextField(blank=True, max_length=1000, null=True, verbose_name='sub title'),
+        ),
+    ]
diff --git a/app/magazine/migrations/0004_auto_20160706_1820.py b/app/magazine/migrations/0004_auto_20160706_1820.py
new file mode 100644 (file)
index 0000000..6c8cba8
--- /dev/null
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-07-06 16:20
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('magazine', '0003_auto_20160706_1810'),
+    ]
+
+    operations = [
+        migrations.AlterModelOptions(
+            name='article',
+            options={'verbose_name': 'article'},
+        ),
+    ]
diff --git a/app/magazine/migrations/0005_auto_20160706_1831.py b/app/magazine/migrations/0005_auto_20160706_1831.py
new file mode 100644 (file)
index 0000000..5835bf9
--- /dev/null
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-07-06 16:31
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('magazine', '0004_auto_20160706_1820'),
+    ]
+
+    operations = [
+        migrations.AlterModelOptions(
+            name='article',
+            options={},
+        ),
+    ]
diff --git a/app/magazine/migrations/0006_auto_20160706_1839.py b/app/magazine/migrations/0006_auto_20160706_1839.py
new file mode 100644 (file)
index 0000000..4123d5b
--- /dev/null
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-07-06 16:39
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('magazine', '0005_auto_20160706_1831'),
+    ]
+
+    operations = [
+        migrations.RemoveField(
+            model_name='article',
+            name='sub_title_en',
+        ),
+        migrations.RemoveField(
+            model_name='article',
+            name='sub_title_fr',
+        ),
+    ]
diff --git a/app/magazine/migrations/0007_auto_20160706_1841.py b/app/magazine/migrations/0007_auto_20160706_1841.py
new file mode 100644 (file)
index 0000000..19d320f
--- /dev/null
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-07-06 16:41
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('magazine', '0006_auto_20160706_1839'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='article',
+            name='sub_title_en',
+            field=models.TextField(blank=True, max_length=1000, null=True, verbose_name='sub title'),
+        ),
+        migrations.AddField(
+            model_name='article',
+            name='sub_title_fr',
+            field=models.TextField(blank=True, max_length=1000, null=True, verbose_name='sub title'),
+        ),
+    ]
diff --git a/app/magazine/migrations/0008_auto_20160706_1852.py b/app/magazine/migrations/0008_auto_20160706_1852.py
new file mode 100644 (file)
index 0000000..d3c2b12
--- /dev/null
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-07-06 16:52
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('magazine', '0007_auto_20160706_1841'),
+    ]
+
+    operations = [
+        migrations.AlterModelOptions(
+            name='article',
+            options={'verbose_name': 'article'},
+        ),
+    ]
diff --git a/app/magazine/migrations/0009_auto_20160707_1047.py b/app/magazine/migrations/0009_auto_20160707_1047.py
new file mode 100644 (file)
index 0000000..cf8c6f7
--- /dev/null
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-07-07 08:47
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('magazine', '0008_auto_20160706_1852'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='article',
+            name='sub_title',
+            field=models.CharField(blank=True, max_length=1000, verbose_name='sub title'),
+        ),
+        migrations.AlterField(
+            model_name='article',
+            name='sub_title_en',
+            field=models.CharField(blank=True, max_length=1000, null=True, verbose_name='sub title'),
+        ),
+        migrations.AlterField(
+            model_name='article',
+            name='sub_title_fr',
+            field=models.CharField(blank=True, max_length=1000, null=True, verbose_name='sub title'),
+        ),
+    ]
diff --git a/app/magazine/migrations/0010_auto_20160707_1115.py b/app/magazine/migrations/0010_auto_20160707_1115.py
new file mode 100644 (file)
index 0000000..99f5b9c
--- /dev/null
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-07-07 09:24
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('magazine', '0009_auto_20160707_1047'),
+    ]
+
+    operations = [
+        migrations.RemoveField(
+            model_name='article',
+            name='sub_title_en',
+        ),
+        migrations.RemoveField(
+            model_name='article',
+            name='sub_title_fr',
+        ),
+    ]
diff --git a/app/magazine/migrations/0011_auto_20160707_1125.py b/app/magazine/migrations/0011_auto_20160707_1125.py
new file mode 100644 (file)
index 0000000..44cb328
--- /dev/null
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.7 on 2016-07-07 09:25
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('magazine', '0010_auto_20160707_1115'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='article',
+            name='sub_title_en',
+            field=models.CharField(blank=True, max_length=1000, null=True, verbose_name='sub title'),
+        ),
+        migrations.AddField(
+            model_name='article',
+            name='sub_title_fr',
+            field=models.CharField(blank=True, max_length=1000, null=True, verbose_name='sub title'),
+        ),
+    ]
index 267d5cdf212cff0a0eddc3556c6dfc43fc519e9b..8384c5f87e6fe3848408910bb804e35df4d996aa 100644 (file)
@@ -1,8 +1,18 @@
 from __future__ import unicode_literals
-
 from django.db import models
+from django.utils.translation import ugettext_lazy as _
+from django.core.urlresolvers import reverse, reverse_lazy
+from mezzanine.blog.models import BlogPost
+from organization.models import BaseNameModel
+
+class Article(BlogPost):
 
+    sub_title = models.CharField(_('sub title'), blank=True, max_length=1000)
 
+    class Meta:
+        verbose_name = _('article')
+
+# concert, spectacle etc....
 class Category(BaseNameModel):
     """(Category description)"""
 
@@ -12,7 +22,7 @@ class Category(BaseNameModel):
     def __unicode__(self):
         return self.name
 
-
+# rubrique du magazine
 class Topic(BaseNameModel):
     """(Topic description)"""
 
diff --git a/app/magazine/translations.py b/app/magazine/translations.py
new file mode 100644 (file)
index 0000000..ba743be
--- /dev/null
@@ -0,0 +1,13 @@
+from modeltranslation.translator import translator, register, TranslationOptions
+from mezzanine.pages.models import Page, RichText
+from modeltranslation.translator import TranslationOptions
+from mezzanine.core.translation import (TranslatedSlugged,
+                                        TranslatedDisplayable,
+                                        TranslatedRichText)
+from magazine.models import Article
+
+@register(Article)
+#class ArticleTranslationOptions(TranslatedDisplayable, TranslatedRichText):
+class ArticleTranslationOptions(TranslationOptions):
+
+    fields = ('sub_title',)
index 18b8e05f7326e4f7c003ff101406c748a0cc8ad9..6a388f9115599d2368ef43d0bcf607dc202ca223 100644 (file)
@@ -221,6 +221,7 @@ INSTALLED_APPS = [
     "mezzanine.accounts",
     # "mezzanine.mobile",
     # "eve",
+    "magazine",
     'djangobower',
     "meta",
     "mezzanine_agenda",
@@ -248,6 +249,7 @@ MIGRATION_MODULES = {
 
 MODELTRANSLATION_TRANSLATION_FILES = (
     'custom.translations',
+    'magazine.translations',
     'translations',
 )