From: Guillaume Pellerin Date: Thu, 31 Mar 2016 18:20:30 +0000 (+0200) Subject: Fix some settings and sync X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=fe82f87791d4f88550e0497f50e2f1a78eb4eec0;p=mezzo.git Fix some settings and sync --- diff --git a/app/festival/management/commands/sync-eve-events.py b/app/festival/management/commands/sync-eve-events.py index 9352526b..e6edc437 100644 --- a/app/festival/management/commands/sync-eve-events.py +++ b/app/festival/management/commands/sync-eve-events.py @@ -23,8 +23,8 @@ class Command(BaseCommand): default_user = User.objects.get(username='admin') def cleanup(self): - for event in ma_models.Event.objects.all(): - event.delete() + # for event in ma_models.Event.objects.all(): + # event.delete() for location in ma_models.EventLocation.objects.all(): location.delete() @@ -50,8 +50,12 @@ class Command(BaseCommand): event.end = manifestation.happens_at + timedelta(seconds=manifestation.duration) event.title = event_trans.name event.user = self.default_user - - location, c = ma_models.EventLocation.objects.get_or_create(title=manifestation.location.name) + + locations = ma_models.EventLocation.objects.filter(title=manifestation.location.name) + if locations: + location = locations[0] + else: + location = ma_models.EventLocation(title=manifestation.location.name) address = '\n'.join([manifestation.location.address, manifestation.location.postalcode + ' ' + manifestation.location.city]) location.address = address location.clean() diff --git a/app/festival/templatetags/festival_tags.py b/app/festival/templatetags/festival_tags.py index 956cc302..e42b10c7 100644 --- a/app/festival/templatetags/festival_tags.py +++ b/app/festival/templatetags/festival_tags.py @@ -28,3 +28,7 @@ def festival_event_featured(*args): @register.filter def subtract(value, arg): return value - arg + +@register.as_tag +def festival_shop_url(*args): + return settings.EVENT_SHOP_URL diff --git a/app/migrations/mezzanine_agenda/0004_auto_20160331_1832.py b/app/migrations/mezzanine_agenda/0004_auto_20160331_1832.py new file mode 100644 index 00000000..d48289d7 --- /dev/null +++ b/app/migrations/mezzanine_agenda/0004_auto_20160331_1832.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.2 on 2016-03-31 16:32 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('mezzanine_agenda', '0003_auto_20160309_1621'), + ] + + operations = [ + migrations.AlterField( + model_name='event', + name='location', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='mezzanine_agenda.EventLocation'), + ), + ] diff --git a/app/sandbox/local_settings.py b/app/sandbox/local_settings.py index dec4e3ec..c58e930c 100644 --- a/app/sandbox/local_settings.py +++ b/app/sandbox/local_settings.py @@ -38,6 +38,9 @@ DATABASES = { } +DATABASE_ROUTERS = ['eve.routers.EveRouter',] + + # EXTENSIONS AND FORMATS # Allowed Extensions for File Upload. Lower case is important. FILEBROWSER_EXTENSIONS = { @@ -74,8 +77,6 @@ SITE_TAGLINE = 'Festival 2 juin | 2 juillet 2016' SILENCED_SYSTEM_CHECKS = ['fields.W342',] -EVENT_USE_FEATURED_IMAGE = True - ADMIN_MENU_ORDER = ( (_("Content"), ("pages.Page", "blog.BlogPost", "mezzanine_agenda.Event", "festival.Artist", "festival.Video", "festival.Audio", "festival.Playlist", @@ -96,5 +97,6 @@ warnings.filterwarnings( RuntimeWarning, r'django\.db\.models\.fields') EVENT_GOOGLE_MAPS_DOMAIN = 'maps.google.fr' - -DATABASE_ROUTERS = ['eve.routers.EveRouter',] +EVENT_PER_PAGE = 8 +EVENT_USE_FEATURED_IMAGE = True +EVENT_SHOP_URL = 'http://eve.ircam.fr/pub.php/manifestation/' diff --git a/requirements-dev.txt b/requirements-dev.txt index 420203dd..4e0ea0eb 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,3 +1,3 @@ --e git+https://github.com/yomguy/mezzanine-agenda.git#egg=mezzanine-agenda-0.2.1 +-e git+https://github.com/yomguy/mezzanine-agenda.git#egg=mezzanine-agenda-0.2.2 -e git+https://github.com/stephenmcd/mezzanine.git#egg=mezzanine-4.1-dev https://forge.ircam.fr/p/django-eve/source/download/dev/