diff --git a/jm2l/__init__.py b/jm2l/__init__.py index a294324..bc33bfb 100644 --- a/jm2l/__init__.py +++ b/jm2l/__init__.py @@ -18,12 +18,14 @@ from apscheduler.schedulers.background import BackgroundScheduler from pyramid.request import Request from mako.template import Template from .models import User -import logging +from jm2l.const import CurrentYear +import logging def add_renderer_globals(event): event['mytrip'] = Sejour_helpers(event) event['myorga'] = Orga_helpers(event) + event['CurrentYear'] = CurrentYear #@sched.scheduled_job('cron', day_of_week='sun', hour=22, minute=07) def mailer_tasks(config): diff --git a/jm2l/const.py b/jm2l/const.py new file mode 100644 index 0000000..01b0230 --- /dev/null +++ b/jm2l/const.py @@ -0,0 +1 @@ +CurrentYear = 2017 \ No newline at end of file diff --git a/jm2l/helpers.py b/jm2l/helpers.py index cd75013..0391e47 100644 --- a/jm2l/helpers.py +++ b/jm2l/helpers.py @@ -2,6 +2,7 @@ from .models import DBSession, JM2L_Year, Sejour from datetime import timedelta, datetime import itertools +from jm2l.const import CurrentYear class DummySejour(object): diff --git a/jm2l/models.py b/jm2l/models.py index e573454..ec6800a 100644 --- a/jm2l/models.py +++ b/jm2l/models.py @@ -31,12 +31,11 @@ from sqlalchemy.orm import ( ) from zope.sqlalchemy import ZopeTransactionExtension +from jm2l.const import CurrentYear DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension())) Base = declarative_base() -CurrentYear = 2015 - class TasksArea(Base): __tablename__ = 'staff_tasks_area' uid = Column(Integer, primary_key=True) @@ -174,19 +173,19 @@ class User(Base): return None @property - def is_Intervenant(self, year=2015): + def is_Intervenant(self, year=CurrentYear): """ This property will return if User do an event on specified year """ return DBSession.query(Event).join(User_Event) \ .filter(User_Event.user_uid==self.uid) \ .filter(Event.for_year==year).count() @property - def is_crew(self, year=2015): + def is_crew(self, year=CurrentYear): """ This property will return if User subscribe orga task on specified year """ return DBSession.query(User,Sejour.orga_part).outerjoin(Sejour).filter(User.uid == self.uid).one()[1] - def year_events(self, EventType='All', year=2015): + def year_events(self, EventType='All', year=CurrentYear): if EventType=='All': return filter(lambda e: e.for_year==year, self.events) else: @@ -490,13 +489,13 @@ class Exchange(Base): @classmethod def get_counters(cls): return DBSession.query(cls.exch_state, cls.exch_type, cls.exch_done, func.count(cls.exch_id))\ - .filter(cls.for_year==2015)\ + .filter(cls.for_year==CurrentYear)\ .group_by(cls.exch_state, cls.exch_type, cls.exch_done) @classmethod def get_my_counters(cls, uid): return DBSession.query(cls.exch_state, cls.exch_type, cls.exch_done, func.count(cls.exch_id))\ - .filter(cls.for_year==2015)\ + .filter(cls.for_year==CurrentYear)\ .filter( or_(cls.asker_id==uid, cls.provider_id==uid) )\ .group_by(cls.exch_state, cls.exch_type, cls.exch_done) @@ -510,7 +509,7 @@ class Exchange(Base): DicResult[extype][exstate]=[] DicResult[extype]['Counters']={'AllAsk':0, 'AllProp':0, 'AllAgree':0} Query = DBSession.query(cls)\ - .filter(cls.for_year==2015)\ + .filter(cls.for_year==CurrentYear)\ .order_by(cls.start_time).all() for item in Query: if item.exch_done: @@ -537,7 +536,7 @@ class Exchange(Base): @classmethod def get_pub_list(cls, exch_type): - return DBSession.query(cls).filter(cls.for_year==2015 and cls.exch_state in ['Ask','Proposal'])\ + return DBSession.query(cls).filter(cls.for_year==CurrentYear and cls.exch_state in ['Ask','Proposal'])\ .filter(cls.exch_type=='%s' % exch_type)\ .filter(cls.exch_done==False)\ .all() @@ -546,13 +545,13 @@ class Exchange(Base): def get_my_list(cls, uid, exch_type): DicResult = {} DicResult['Ask']=DBSession.query(cls)\ - .filter(cls.for_year==2015)\ + .filter(cls.for_year==CurrentYear)\ .filter( or_(cls.asker_id==uid, cls.provider_id==uid) )\ .filter(cls.exch_type=='%s' % exch_type)\ .filter(cls.exch_state=='Ask')\ .order_by(cls.start_time).all() DicResult['Proposal']=DBSession.query(cls)\ - .filter(cls.for_year==2015)\ + .filter(cls.for_year==CurrentYear)\ .filter( or_(cls.asker_id==uid, cls.provider_id==uid) )\ .filter(cls.exch_type=='%s' % exch_type)\ .filter(cls.exch_state=='Proposal')\ diff --git a/jm2l/static/img/2015/logo.png b/jm2l/static/img/2015/logo.png index 5b0b30a..4d11a28 100644 Binary files a/jm2l/static/img/2015/logo.png and b/jm2l/static/img/2015/logo.png differ diff --git a/jm2l/static/img/2015/logo_3.png b/jm2l/static/img/2015/logo_3.png index 4d11a28..5b0b30a 100644 Binary files a/jm2l/static/img/2015/logo_3.png and b/jm2l/static/img/2015/logo_3.png differ diff --git a/jm2l/static/img/2017/Photos/P1010063.JPG b/jm2l/static/img/2017/Photos/P1010063.JPG new file mode 100644 index 0000000..d3c1961 Binary files /dev/null and b/jm2l/static/img/2017/Photos/P1010063.JPG differ diff --git a/jm2l/static/img/2017/Photos/P1010064.JPG b/jm2l/static/img/2017/Photos/P1010064.JPG new file mode 100644 index 0000000..ad96ce2 Binary files /dev/null and b/jm2l/static/img/2017/Photos/P1010064.JPG differ diff --git a/jm2l/static/img/2017/Photos/P1010067.JPG b/jm2l/static/img/2017/Photos/P1010067.JPG new file mode 100644 index 0000000..c095cf4 Binary files /dev/null and b/jm2l/static/img/2017/Photos/P1010067.JPG differ diff --git a/jm2l/static/img/2017/Photos/P1010069.JPG b/jm2l/static/img/2017/Photos/P1010069.JPG new file mode 100644 index 0000000..58ff55d Binary files /dev/null and b/jm2l/static/img/2017/Photos/P1010069.JPG differ diff --git a/jm2l/static/img/2017/Photos/P1010070.JPG b/jm2l/static/img/2017/Photos/P1010070.JPG new file mode 100644 index 0000000..dfd2e78 Binary files /dev/null and b/jm2l/static/img/2017/Photos/P1010070.JPG differ diff --git a/jm2l/static/img/2017/Photos/P1010122.JPG b/jm2l/static/img/2017/Photos/P1010122.JPG new file mode 100644 index 0000000..3442c66 Binary files /dev/null and b/jm2l/static/img/2017/Photos/P1010122.JPG differ diff --git a/jm2l/static/img/2017/Photos/P1010123.JPG b/jm2l/static/img/2017/Photos/P1010123.JPG new file mode 100644 index 0000000..c40e352 Binary files /dev/null and b/jm2l/static/img/2017/Photos/P1010123.JPG differ diff --git a/jm2l/static/img/2017/Photos/P1010126.JPG b/jm2l/static/img/2017/Photos/P1010126.JPG new file mode 100644 index 0000000..8ae62ef Binary files /dev/null and b/jm2l/static/img/2017/Photos/P1010126.JPG differ diff --git a/jm2l/static/img/2017/Photos/P1010127.JPG b/jm2l/static/img/2017/Photos/P1010127.JPG new file mode 100644 index 0000000..83f738c Binary files /dev/null and b/jm2l/static/img/2017/Photos/P1010127.JPG differ diff --git a/jm2l/static/img/2017/Photos/P1010129.JPG b/jm2l/static/img/2017/Photos/P1010129.JPG new file mode 100644 index 0000000..92aa105 Binary files /dev/null and b/jm2l/static/img/2017/Photos/P1010129.JPG differ diff --git a/jm2l/static/img/2017/Photos/P5050002.JPG b/jm2l/static/img/2017/Photos/P5050002.JPG new file mode 100644 index 0000000..e15e6f8 Binary files /dev/null and b/jm2l/static/img/2017/Photos/P5050002.JPG differ diff --git a/jm2l/static/img/2017/Photos/P5050046.JPG b/jm2l/static/img/2017/Photos/P5050046.JPG new file mode 100644 index 0000000..897a2ef Binary files /dev/null and b/jm2l/static/img/2017/Photos/P5050046.JPG differ diff --git a/jm2l/static/img/2017/Photos/panneau_stand.jpg b/jm2l/static/img/2017/Photos/panneau_stand.jpg new file mode 100644 index 0000000..b8f416d Binary files /dev/null and b/jm2l/static/img/2017/Photos/panneau_stand.jpg differ diff --git a/jm2l/static/img/2017/logo.png b/jm2l/static/img/2017/logo.png new file mode 100644 index 0000000..31fc741 Binary files /dev/null and b/jm2l/static/img/2017/logo.png differ diff --git a/jm2l/static/img/2017/logo_1.png b/jm2l/static/img/2017/logo_1.png new file mode 100644 index 0000000..5b0b30a Binary files /dev/null and b/jm2l/static/img/2017/logo_1.png differ diff --git a/jm2l/templates/Interventions/Interventions.mako b/jm2l/templates/Interventions/Interventions.mako index 370cc12..262704b 100644 --- a/jm2l/templates/Interventions/Interventions.mako +++ b/jm2l/templates/Interventions/Interventions.mako @@ -106,9 +106,9 @@ elif Type=='T': %> % if Type!='O':