]> git.parisson.com Git - mezzo.git/commitdiff
add mezzanine_agenda and reorder festival models, add translations
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Wed, 24 Feb 2016 10:25:05 +0000 (11:25 +0100)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Wed, 24 Feb 2016 10:25:05 +0000 (11:25 +0100)
16 files changed:
app/deploy/start_app.sh
app/festival/admin.py
app/festival/migrations/0001_initial.py
app/festival/migrations/0002_auto_20160201_2339.py [deleted file]
app/festival/migrations/0003_artist_content.py [deleted file]
app/festival/migrations/0004_auto_20160202_0002.py [deleted file]
app/festival/migrations/0005_auto_20160202_0006.py [deleted file]
app/festival/models.py
app/sandbox/local_settings.py
app/sandbox/settings.py
app/sandbox/urls.py
app/templates/base.html
app/translations.py [new file with mode: 0644]
app/wait.py
requirements-dev.txt
requirements.txt

index 43f7e9c0282fa6e7b65fd52a036c5551155dd401..b4a8b98f5fb8c91408e3e05e3105f0fdf373c203 100644 (file)
@@ -6,6 +6,7 @@ manage=$app'/manage.py'
 wsgi=$app'/wsgi.py'
 static='/srv/static/'
 media='/srv/media/'
+src='/srv/src/'
 
 # uwsgi params
 port=8000
@@ -16,7 +17,7 @@ uid='www-data'
 gid='www-data'
 
 # Staging
-pip install psycopg2
+pip install psycopg2
 
 chown -R $uid:$gid $media
 
@@ -24,7 +25,7 @@ chown -R $uid:$gid $media
 sh $app/deploy/wait.sh
 
 # waiting for available database
-python $app/wait.py
+python $app/wait.py
 # python $manage wait-for-db-connection
 
 # django init
@@ -35,10 +36,15 @@ python $manage create-admin-user
 
 # static files auto update
 watchmedo shell-command --patterns="*.js;*.css" --recursive \
-    --command='python '$manage' collectstatic --noinput' $static &
+    --command='python '$manage' collectstatic --noinput' $src &
 
 # app start
-uwsgi --socket :$port --wsgi-file $wsgi --chdir $app --master \
+if [ $1 == "--runserver" ]
+then
+    python $manage runserver_plus 0.0.0.0:8000
+else
+    uwsgi --socket :$port --wsgi-file $wsgi --chdir $app --master \
     --processes $processes --threads $threads \
     --uid $uid --gid $gid \
     --py-autoreload $autoreload
+fi
index 2b6d01cbd8367b9f520e98e05ea8fcff824cc1a1..0effca5a194a3080f9284488fda23d6c975ac19e 100644 (file)
@@ -1,7 +1,6 @@
 from django.contrib import admin
 from festival.models import *
 
-admin.site.register(Event)
+admin.site.register(MetaEvent)
 admin.site.register(Artist)
-admin.site.register(Location)
 admin.site.register(Video)
index dc398e8136bc5739cbfdb9655f940dcf196e3b3b..94e63fb56841d5e1acaa8e2cc328bb88fe897185 100644 (file)
@@ -2,11 +2,14 @@
 from __future__ import unicode_literals
 
 from django.db import migrations, models
+import django.db.models.deletion
+import mezzanine.core.fields
 
 
 class Migration(migrations.Migration):
 
     dependencies = [
+        ('mezzanine_agenda', '0001_initial'),
         ('sites', '0001_initial'),
     ]
 
@@ -16,41 +19,29 @@ class Migration(migrations.Migration):
             fields=[
                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                 ('name', models.CharField(max_length=255, verbose_name='name')),
-                ('photo', models.ImageField(upload_to=b'photos/%Y/%m/%d', max_length=1024, verbose_name='photo')),
-            ],
-        ),
-        migrations.CreateModel(
-            name='Event',
-            fields=[
-                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
-                ('keywords_string', models.CharField(max_length=500, editable=False, blank=True)),
-                ('title', models.CharField(max_length=500, verbose_name='Title')),
-                ('slug', models.CharField(help_text='Leave blank to have the URL auto-generated from the title.', max_length=2000, null=True, verbose_name='URL', blank=True)),
-                ('_meta_title', models.CharField(help_text='Optional title to be used in the HTML title tag. If left blank, the main title field will be used.', max_length=500, null=True, verbose_name='Title', blank=True)),
-                ('description', models.TextField(verbose_name='Description', blank=True)),
-                ('gen_description', models.BooleanField(default=True, help_text='If checked, the description will be automatically generated from content. Uncheck if you want to manually set a custom description.', verbose_name='Generate description')),
-                ('created', models.DateTimeField(null=True, editable=False)),
-                ('updated', models.DateTimeField(null=True, editable=False)),
-                ('status', models.IntegerField(default=2, help_text='With Draft chosen, will only be shown for admin users on the site.', verbose_name='Status', choices=[(1, 'Draft'), (2, 'Published')])),
-                ('publish_date', models.DateTimeField(help_text="With Published chosen, won't be shown until this time", null=True, verbose_name='Published from', db_index=True, blank=True)),
-                ('expiry_date', models.DateTimeField(help_text="With Published chosen, won't be shown after this time", null=True, verbose_name='Expires on', blank=True)),
-                ('short_url', models.URLField(null=True, blank=True)),
-                ('in_sitemap', models.BooleanField(default=True, verbose_name='Show in sitemap')),
-                ('event_id', models.IntegerField()),
-                ('artists', models.ManyToManyField(related_name='events', null=True, verbose_name='events', to='festival.Artist', blank=True)),
-                ('site', models.ForeignKey(editable=False, to='sites.Site')),
+                ('photo', models.ImageField(upload_to=b'images/%Y/%m/%d', max_length=1024, verbose_name='photo')),
+                ('photo_credits', models.CharField(max_length=255, null=True, verbose_name='photo credits', blank=True)),
+                ('bio', mezzanine.core.fields.RichTextField(null=True, verbose_name='bio', blank=True)),
             ],
             options={
-                'db_table': 'event',
-                'verbose_name': 'event',
+                'db_table': 'festival_artists',
+                'verbose_name': 'artist',
             },
         ),
         migrations.CreateModel(
-            name='Location',
+            name='MetaEvent',
             fields=[
                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
-                ('location_id', models.IntegerField()),
+                ('eve_event_id', models.IntegerField(verbose_name='eve id', blank=True)),
+                ('featured', models.BooleanField(verbose_name='featured')),
+                ('featured_image', mezzanine.core.fields.FileField(max_length=1024, verbose_name='featured image', blank=True)),
+                ('artists', models.ManyToManyField(related_name='metaevents', verbose_name='artists', to='festival.Artist', blank=True)),
+                ('event', models.ForeignKey(related_name='meta_events', on_delete=django.db.models.deletion.SET_NULL, verbose_name='meta event', blank=True, to='mezzanine_agenda.Event', null=True)),
             ],
+            options={
+                'db_table': 'festival_meta_events',
+                'verbose_name': 'meta event',
+            },
         ),
         migrations.CreateModel(
             name='Video',
@@ -69,8 +60,8 @@ class Migration(migrations.Migration):
                 ('expiry_date', models.DateTimeField(help_text="With Published chosen, won't be shown after this time", null=True, verbose_name='Expires on', blank=True)),
                 ('short_url', models.URLField(null=True, blank=True)),
                 ('in_sitemap', models.BooleanField(default=True, verbose_name='Show in sitemap')),
-                ('media_id', models.IntegerField(verbose_name='media ID')),
-                ('artists', models.ManyToManyField(related_name='videos', null=True, verbose_name='artists', to='festival.Artist', blank=True)),
+                ('media_id', models.IntegerField(verbose_name='media id')),
+                ('event', models.ForeignKey(related_name='videos', on_delete=django.db.models.deletion.SET_NULL, verbose_name='meta event', blank=True, to='mezzanine_agenda.Event', null=True)),
                 ('site', models.ForeignKey(editable=False, to='sites.Site')),
             ],
             options={
diff --git a/app/festival/migrations/0002_auto_20160201_2339.py b/app/festival/migrations/0002_auto_20160201_2339.py
deleted file mode 100644 (file)
index 9525044..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
-    dependencies = [
-        ('festival', '0001_initial'),
-    ]
-
-    operations = [
-        migrations.AlterField(
-            model_name='event',
-            name='artists',
-            field=models.ManyToManyField(related_name='events', verbose_name='events', to='festival.Artist', blank=True),
-        ),
-        migrations.AlterField(
-            model_name='video',
-            name='artists',
-            field=models.ManyToManyField(related_name='videos', verbose_name='artists', to='festival.Artist', blank=True),
-        ),
-    ]
diff --git a/app/festival/migrations/0003_artist_content.py b/app/festival/migrations/0003_artist_content.py
deleted file mode 100644 (file)
index 18d6d86..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import mezzanine.core.fields
-
-
-class Migration(migrations.Migration):
-
-    dependencies = [
-        ('festival', '0002_auto_20160201_2339'),
-    ]
-
-    operations = [
-        migrations.AddField(
-            model_name='artist',
-            name='content',
-            field=mezzanine.core.fields.RichTextField(default='', verbose_name='Content'),
-            preserve_default=False,
-        ),
-    ]
diff --git a/app/festival/migrations/0004_auto_20160202_0002.py b/app/festival/migrations/0004_auto_20160202_0002.py
deleted file mode 100644 (file)
index f72243e..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-import mezzanine.core.fields
-
-
-class Migration(migrations.Migration):
-
-    dependencies = [
-        ('festival', '0003_artist_content'),
-    ]
-
-    operations = [
-        migrations.RemoveField(
-            model_name='artist',
-            name='content',
-        ),
-        migrations.AddField(
-            model_name='artist',
-            name='bio',
-            field=mezzanine.core.fields.RichTextField(null=True, verbose_name='bio', blank=True),
-        ),
-    ]
diff --git a/app/festival/migrations/0005_auto_20160202_0006.py b/app/festival/migrations/0005_auto_20160202_0006.py
deleted file mode 100644 (file)
index 042cfb6..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
-    dependencies = [
-        ('festival', '0004_auto_20160202_0002'),
-    ]
-
-    operations = [
-        migrations.AddField(
-            model_name='artist',
-            name='photo_credits',
-            field=models.CharField(max_length=255, null=True, verbose_name='photo credits', blank=True),
-        ),
-        migrations.AlterField(
-            model_name='event',
-            name='artists',
-            field=models.ManyToManyField(related_name='events', verbose_name='artists', to='festival.Artist', blank=True),
-        ),
-    ]
index 54fd0a659b6e2241bcdfa677d58f319a276cda8a..092a3c71c5381901d18188991516df63c408d7a3 100644 (file)
@@ -2,39 +2,45 @@ from django.db import models
 from django.utils.translation import ugettext_lazy as _
 
 from mezzanine.core.models import RichText, Displayable
-from mezzanine.core.fields import RichTextField, OrderField
+from mezzanine.core.fields import RichTextField, OrderField, FileField
 
-import eve.models
+from mezzanine_agenda.models import Event
+
+# import eve.models
 
 from .related import SpanningForeignKey
 
+app_label = 'festival'
+
 
 class MetaCore:
 
     app_label = 'festival'
 
 
-class Event(Displayable):
-    """(Event description)"""
+class MetaEvent(models.Model):
+    """Extensible event metadata"""
 
-    event_id = models.IntegerField()
-    # event = SpanningForeignKey(eve.models.EventVersion, related_name='festival_events', verbose_name=_('E-venement event'), blank=True, null=True, default=None)
-    rich_description = RichText(_('rich description'))
-    artists = models.ManyToManyField('Artist', related_name='events', verbose_name=_('artists'), blank=True)
+    event = models.ForeignKey(Event, related_name='meta_events', verbose_name=_('meta event'), blank=True, null=True, on_delete=models.SET_NULL)
+    #eve_event = SpanningForeignKey(eve.models.EventVersion, related_name='festival_events', verbose_name=_('E-venement event'), blank=True, null=True, default=None)
+    eve_event_id = models.IntegerField(_('eve id'), blank=True)
+    artists = models.ManyToManyField('Artist', related_name='metaevents', verbose_name=_('artists'), blank=True)
+    featured = models.BooleanField(_('featured'))
+    featured_image = FileField(_('featured image'), upload_to='images/%Y/%m/%d', max_length=1024, blank=True, format="Image")
 
     class Meta(MetaCore):
-        verbose_name = _('event')
-        db_table = 'event'
+        verbose_name = _('meta event')
+        db_table = app_label + '_meta_events'
 
     def __unicode__(self):
-        return self.title
+        return self.event.title
 
 
 class Artist(models.Model):
-    """(Artist description)"""
+    """Artist"""
 
     name = models.CharField(_('name'), max_length=255)
-    photo = models.ImageField(_('photo'), upload_to='photos/%Y/%m/%d', max_length=1024)
+    photo = models.ImageField(_('photo'), upload_to='images/%Y/%m/%d', max_length=1024)
     photo_credits = models.CharField(_('photo credits'), max_length=255, blank=True, null=True)
     bio = RichTextField(_("bio"), blank=True, null=True)
 
@@ -43,21 +49,16 @@ class Artist(models.Model):
     def __unicode__(self):
         return self.name
 
+    class Meta(MetaCore):
+        verbose_name = _('artist')
+        db_table = app_label + '_artists'
+
 
 class Video(Displayable):
-    """(Video description)"""
+    """Video"""
 
-    media_id = models.IntegerField(_('media ID'))
-    artists = models.ManyToManyField('Artist', related_name='videos', verbose_name=_('artists'), blank=True)
+    event = models.ForeignKey(Event, related_name='videos', verbose_name=_('meta event'), blank=True, null=True, on_delete=models.SET_NULL)
+    media_id = models.IntegerField(_('media id'))
 
     def __unicode__(self):
         return u"Video"
-
-
-class Location(models.Model):
-    """(Location description)"""
-
-    location_id = models.IntegerField()
-
-    def __unicode__(self):
-        return u"Location"
index 6956d449a14f9a4861824f824b624b027132ca27..711ed88ee708afee78f3eaf7cd6f7b21a5718b85 100644 (file)
@@ -7,7 +7,7 @@ SECRET_KEY = "+3b01&_6_m@@yb4f06$s0zno8vkybh81nbuj_q(xzk+xeih1+s"
 NEVERCACHE_KEY = "l11tr%#!uc@+%$51(&+%=&z6h9yrw42(jpcj$3_&6evtu6hl%z"
 
 # DATABASE_ROUTERS = ['eve.routers.EveRouter', 'festival.routers.FestivalRouter',]
-DATABASE_ROUTERS = ['eve.routers.EveRouter',]
+DATABASE_ROUTERS = ['eve.routers.EveRouter',]
 
 DATABASES = {
     'default': {
index 51f05f7c7d67f0a0d1cd6336bd9f9c807175d2c7..8055a67e797bdcc2310accf137e9e292498c94a5 100644 (file)
@@ -197,6 +197,7 @@ TEMPLATE_DIRS = (os.path.join(PROJECT_ROOT, "templates"),)
 ################
 
 INSTALLED_APPS = [
+    "modeltranslation",
     "django.contrib.admin",
     "django.contrib.auth",
     "django.contrib.contenttypes",
@@ -219,9 +220,7 @@ INSTALLED_APPS = [
     # "eve",
     "festival",
     "meta",
-    'mezzanine-agenda',
-    'mezzanine_people',
-
+    'mezzanine_agenda',
 ]
 
 # Add Migration Module path see : https://github.com/stephenmcd/mezzanine/blob/master/docs/model-customization.rst#field-injection-caveats
@@ -231,8 +230,13 @@ MIGRATION_MODULES = {
     "galleries": "migrations.galleries",
     "pages": "migrations.pages",
     "conf": "migrations.conf",
+    "mezzanine_agenda": "migrations.mezzanine_agenda",
 }
 
+MODELTRANSLATION_TRANSLATION_FILES = (
+    'translations',
+)
+
 # List of processors used by RequestContext to populate the context.
 # Each one should be a callable that takes the request object as its
 # only parameter and returns a dictionary to add to the context.
index e911e9704459dcd235e52af5197fbd61e36b3e28..a5836b717ff7f7ba464b03e76b50c5a94b1e7a30 100644 (file)
@@ -26,7 +26,6 @@ if settings.USE_MODELTRANSLATION:
 
 urlpatterns += patterns('',
     url(r'^festival/', include('festival.urls')),
-    url(r'^people/', include('mezzanine_people.urls')),
     url("^%s/" % settings.EVENT_SLUG, include("mezzanine_agenda.urls")),
 
     # We don't want to presume how your homepage works, so here are a
index 9d3d705bbbc885b8a5ae283dffa2a0d0f82ae42a..0f3bb28077805d795539164c93d5d24d07851b94 100644 (file)
 <div class="container">
 <div class="row">
 
-<div class="col-md-2 left">
-    {% block left_panel %}
-    <div class="panel panel-default tree">{% page_menu "pages/menus/tree.html" %}</div>
-    {% endblock %}
-</div>
-
-<div class="col-md-7 middle">
+<div class="col-md-9 left">
     {% block main %}{% endblock %}
 </div>
 
diff --git a/app/translations.py b/app/translations.py
new file mode 100644 (file)
index 0000000..bc1c3f6
--- /dev/null
@@ -0,0 +1,20 @@
+from modeltranslation.translator import register, TranslationOptions
+
+from mezzanine_agenda.models import Event
+from festival.models import MetaEvent, Artist
+
+
+@register(Event)
+class EventTranslationOptions(TranslationOptions):
+
+    fields = ('title',)
+
+
+@register(MetaEvent)
+class MetaEventTranslationOptions(TranslationOptions):
+    pass
+
+
+@register(Artist)
+class ArtistTranslationOptions(TranslationOptions):
+    pass
index 451e5b87e9ebfc9d60ae72a304943bbef5b82ec9..877edbd3018d591cd0701829479949438781e577 100644 (file)
@@ -13,4 +13,3 @@ while not up:
     except:
         print 'waiting...'
         time.sleep(10)
-        call_command('syncdb', interactive=False)
index 5e6ac04362ed2d3ed26c598834991959da3d48f9..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,2 +0,0 @@
-mezzanine-agenda
-mezzanine_people
index 3dd47911afaf6db4356766bb73fbd49870642d00..20bfe0025116be29a292de1045e333ec657ffe1e 100644 (file)
@@ -1,11 +1,10 @@
---index-url https://pypi.python.org/simple/
-
 setuptools
 uwsgi
 watchdog
 MySQL-python==1.2.5
-Django==1.8.7
+Django==1.8.9
 mezzanine==4.0.1
 django-modeltranslation
 django-meta
 psycopg2
+mezzanine-agenda