|
|
@@ -230,18 +230,32 @@ def index_page(request): |
|
|
|
year = request.matchdict.get('year') |
|
|
|
if year: |
|
|
|
year=int(year[:-1]) |
|
|
|
content = DBSession.query(JM2L_Year).filter(JM2L_Year.year_uid==year).first() |
|
|
|
if content: |
|
|
|
content = content.description |
|
|
|
if 2004<year<=CurrentYear: |
|
|
|
if year==2006: |
|
|
|
return {'year': year, 'edition':u"1<sup>ère</sup>" } |
|
|
|
return {'year': year, 'content':content, 'edition':u"1<sup>ère</sup>" } |
|
|
|
elif year==2015: |
|
|
|
return {'year': year, 'edition':u"9<sup>ème</sup>" } |
|
|
|
return {'year': year, 'content':content, 'edition':u"9<sup>ème</sup>" } |
|
|
|
else: |
|
|
|
edition = year - 2005 |
|
|
|
return {'year': year, 'edition':u"%d<sup>ème</sup>" % edition } |
|
|
|
return {'year': year, 'content':content, 'edition':u"%d<sup>ème</sup>" % edition } |
|
|
|
else: |
|
|
|
raise HTTPNotFound() |
|
|
|
return {'year': CurrentYear, 'edition':u"9<sup>ème</sup>"} |
|
|
|
|
|
|
|
@view_config(route_name='edit_index', renderer="jm2l:templates/Staff/EditIndex.mako") |
|
|
|
def edit_index(request): |
|
|
|
year = int(request.matchdict.get('year', None)) |
|
|
|
content = DBSession.query(JM2L_Year).filter(JM2L_Year.year_uid==year).first() |
|
|
|
form = IndexForm(request.POST, content, meta={'csrf_context': request.session}) |
|
|
|
if request.method == 'POST' and form.validate(): |
|
|
|
form.populate_obj(content) |
|
|
|
return HTTPFound(location=request.route_url('home', year="%d/" % year)) |
|
|
|
MainTab = {'home':'active', "logged_in":request.authenticated_userid, |
|
|
|
'form':form, 'DisplayYear':year} |
|
|
|
return MainTab |
|
|
|
|
|
|
|
@view_config(route_name='programme', renderer="jm2l:templates/Public/Programme.mako") |
|
|
|
def programme(request): |
|
|
|