From: Guillaume Pellerin Date: Thu, 31 Mar 2016 16:22:22 +0000 (+0200) Subject: hide event end date when > 3h X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=e24cffb8318ccbb4e207518c4dcc554092d74bd7;p=mezzo.git hide event end date when > 3h --- diff --git a/app/deploy/start_app.sh b/app/deploy/start_app.sh index 664d9bfe..320752d6 100644 --- a/app/deploy/start_app.sh +++ b/app/deploy/start_app.sh @@ -19,6 +19,7 @@ patterns='*.js;*.css;*.jpg;*.jpeg;*.gif;*.png;*.svg;*.ttf;*.eot;*.woff;*.woff2' # Staging # pip install psycopg2 +# pip install -U https://forge.ircam.fr/p/django-eve/source/download/dev/ chown -R $uid:$gid $media diff --git a/app/festival/templatetags/festival_tags.py b/app/festival/templatetags/festival_tags.py index 32351dab..956cc302 100644 --- a/app/festival/templatetags/festival_tags.py +++ b/app/festival/templatetags/festival_tags.py @@ -24,3 +24,7 @@ def festival_event_featured(*args): if hasattr(obj, 'featured_image_header'): featured.append(obj) return featured + +@register.filter +def subtract(value, arg): + return value - arg diff --git a/app/sandbox/local_settings.py b/app/sandbox/local_settings.py index 3cc0a206..dec4e3ec 100644 --- a/app/sandbox/local_settings.py +++ b/app/sandbox/local_settings.py @@ -19,22 +19,22 @@ DATABASES = { 'HOST': 'db', # Set to empty string for localhost. Not used with sqlite3. 'PORT': '3306', # Set to empty string for default. Not used with sqlite3. }, - # 'default': { - # 'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. - # 'USER': 'postgres', # Not used with sqlite3. - # 'PASSWORD': 'mysecretpassword', # Not used with sqlite3. - # 'NAME': 'manifeste', - # 'HOST': 'db', # Set to empty string for localhost. Not used with sqlite3. - # 'PORT': '5432', # Set to empty string for default. Not used with sqlite3. - # }, 'eve': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'eve', - 'USER': 'postgres', - 'PASSWORD': 'mysecretpassword', + 'USER': 'eve', + 'PASSWORD': 'HmazS2frT', 'HOST': 'pgdb', 'PORT': '5432', }, + # 'eve': { + # 'ENGINE': 'django.db.backends.postgresql_psycopg2', + # 'NAME': 'eve', + # 'USER': 'django', + # 'PASSWORD': 'q2nqzt0WGnwWé,256', + # 'HOST': 'eve.ircam.fr', + # 'PORT': '5432', + # }, } @@ -96,3 +96,5 @@ warnings.filterwarnings( RuntimeWarning, r'django\.db\.models\.fields') EVENT_GOOGLE_MAPS_DOMAIN = 'maps.google.fr' + +DATABASE_ROUTERS = ['eve.routers.EveRouter',] diff --git a/app/templates/agenda/includes/event_metainfo.html b/app/templates/agenda/includes/event_metainfo.html index 312be942..462d02e1 100644 --- a/app/templates/agenda/includes/event_metainfo.html +++ b/app/templates/agenda/includes/event_metainfo.html @@ -1,11 +1,10 @@ -{% load i18n mezzanine_tags event_tags %} +{% load i18n mezzanine_tags event_tags festival_tags %} {% editable event.start event.end event.location %}
{{ event.start }} {% if event.end %} -
- {% if event.end|date == event.start|date %}{{ event.end|time:"TIME_FORMAT" }}{% else %}{{ event.end }}{% endif %} + {% if event.end|date == event.start|date and event.end.hour|subtract:event.start.hour > 3 %}{{ event.end|time:"TIME_FORMAT" }}{% endif %} {% endif %} {% if event.location %} {{ event.location }} diff --git a/docker-compose.yml b/docker-compose.yml index 9df06a3c..e1a1d08d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -38,6 +38,15 @@ db: - MYSQL_USER=manifeste - MYSQL_PASSWORD=Onukifsid7 +pgdb: + image: postgres + volumes_from: + - data + environment: + - POSTGRES_PASSWORD=HmazS2frT + - POSTGRES_USER=eve + - POSTGRES_DB=eve + app: build: . command: /bin/sh deploy/start_app.sh @@ -49,7 +58,8 @@ app: - "8000" links: - db - + - pgdb + nginx: image: nginx ports: diff --git a/requirements-dev.txt b/requirements-dev.txt index d6ec1690..420203dd 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.0 +-e git+https://github.com/yomguy/mezzanine-agenda.git#egg=mezzanine-agenda-0.2.1 -e git+https://github.com/stephenmcd/mezzanine.git#egg=mezzanine-4.1-dev --e git+https://github.com/yomguy/django-eve.git#egg=django-eve-1.0 +https://forge.ircam.fr/p/django-eve/source/download/dev/ diff --git a/scripts/restore_db_eve.sh b/scripts/restore_db_eve.sh index d29766d6..2c0f3403 100755 --- a/scripts/restore_db_eve.sh +++ b/scripts/restore_db_eve.sh @@ -1,13 +1,14 @@ #!/bin/bash -export PGPASSWORD="mysecretpassword" -db_exists=`psql -hpgdb -Upostgres -lqt | cut -d \| -f 1 | grep -w eve | wc -l` +export PGPASSWORD="HmazS2frT" -if [ $db_exists == 0 ]; then - psql -hpgdb -Upostgres -c 'create role eve' -else - psql -hpgdb -Upostgres -c 'drop database eve' +db_exists=`psql -hpgdb -Ueve -lqt | cut -d \| -f 1 | grep -w eve | wc -l` + +if [ ! $db_exists == 0 ]; then + psql -hpgdb -Ueve -c 'drop database eve' fi -psql -hpgdb -Upostgres -c 'create database eve' -gunzip -c /srv/backup/eve.sql.gz | psql -hpgdb -Upostgres -q eve +psql -hpgdb -Ueve -c 'create role eve' +psql -hpgdb -Ueve -c 'create role django' +psql -hpgdb -Ueve -c 'create database eve' +gunzip -c /srv/backup/eve.sql.gz | psql -hpgdb -Ueve -q eve