diff --git a/jm2l/models.py b/jm2l/models.py index 78c712e..7443c92 100644 --- a/jm2l/models.py +++ b/jm2l/models.py @@ -111,6 +111,13 @@ class JM2L_Year(Base): date_list = filter(lambda x: x.hour<12 or x.hour>=13, date_list) return date_list + @property + def DocLinks(self): + from .upload import MediaPath + return zip( MediaPath().get_list('presse', self.year_uid, 'Other'), + MediaPath().get_thumb('presse', self.year_uid, 'Other') + ) + class User(Base): __tablename__ = 'users' uid = Column(Integer, primary_key=True) @@ -271,16 +278,23 @@ class Tiers(Base): .filter(Media.media_table == 'tiers') \ .filter(Media.media_type == 'Image') \ .filter(Media.link_id == self.uid) - + + @property + def DocLinks(self): + from .upload import MediaPath + return zip( MediaPath().get_list('tiers', self.uid, 'Other'), + MediaPath().get_thumb('tiers', self.uid, 'Other') + ) + @property def PhotosLinks(self): from .upload import MediaPath - return MediaPath().get_list('tiers', self.uid) + return MediaPath().get_list('tiers', self.uid, 'Image') @property def ThumbLinks(self): from .upload import MediaPath - return MediaPath().get_thumb('tiers', self.uid) + return MediaPath().get_thumb('tiers', self.uid) class Role_Tiers(Base): """ Créer le lien entre le tiers et son rôle dans l'évenement en fonction de l'année""" diff --git a/jm2l/static/img/shadow.svg b/jm2l/static/img/shadow.svg index 1f6a7a0..dfb3e07 100644 --- a/jm2l/static/img/shadow.svg +++ b/jm2l/static/img/shadow.svg @@ -14,19 +14,19 @@ - + - + - + - + \ No newline at end of file diff --git a/jm2l/templates/Logistique/Logistique.mako b/jm2l/templates/Logistique/Logistique.mako index b5fc2bf..7373b0c 100644 --- a/jm2l/templates/Logistique/Logistique.mako +++ b/jm2l/templates/Logistique/Logistique.mako @@ -1,7 +1,7 @@ <%namespace name="h" file="jm2l:templates/helpers.mako"/> <%namespace name="tables" file="jm2l:templates/Logistique/Tables.mako"/> ## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -<%def name="Main(Exchanges)"> +<%def name="Main(Exchanges, miam_form)"> <% DicExch = Exchanges.get_overview( request.user.uid ) %> @@ -17,7 +17,7 @@ DicExch = Exchanges.get_overview( request.user.uid )
${Route_wrapper(DicExch)}
-
${Miam_wrapper()}
+
${Miam_wrapper(miam_form)}
${Exchange_wrapper('C', DicExch['C'])}
${Exchange_wrapper('H', DicExch['H'])}
${Exchange_wrapper('M', DicExch['M'])}
@@ -35,9 +35,14 @@ DicExch = Exchanges.get_overview( request.user.uid ) ## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -<%def name="Miam_wrapper()"> +<%def name="Miam_wrapper(miam_form)">
Qu'est ce qu'on mange ? +<% +DicForm = { + } +%> + ${h.DisplayForm(miam_form, DicForm)}
## -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= diff --git a/jm2l/templates/Profil/Sejour.mako b/jm2l/templates/Profil/Sejour.mako index f577a58..91eaaf7 100644 --- a/jm2l/templates/Profil/Sejour.mako +++ b/jm2l/templates/Profil/Sejour.mako @@ -84,26 +84,26 @@ fieldset:disabled { Départ
Je repars - % for place in Places: % endfor le - , - à - % for hour in range(24): % for minutes in range(0,60,10):
% if entity.website: @@ -88,7 +91,7 @@ ${The_entity_type.entity_subtype}
% if iterv.website:
- ${iterv.website} + ${iterv.website}
% endif
diff --git a/jm2l/upload.py b/jm2l/upload.py index b6f56b3..ce05c93 100644 --- a/jm2l/upload.py +++ b/jm2l/upload.py @@ -43,7 +43,7 @@ mimetypes.init() class MediaPath(): - def get_list(self, media_table, linked_id): + def get_list(self, media_table, linked_id, MediaType=None): filelist = list() curpath = self.get_mediapath(media_table, linked_id, None) if not os.path.isdir(curpath): @@ -54,24 +54,36 @@ class MediaPath(): if f.endswith('.type'): continue if f: + filename, ext = os.path.splitext( f ) tmpurl = '/image/%s/%d/%s' % (media_table, linked_id, f) - filelist.append(tmpurl) + if MediaType is None: + filelist.append(tmpurl) + elif MediaType=='Image' and ext.lower() in ['.gif','.jpg','.png','.svg','.jpeg']: + filelist.append(tmpurl) + elif MediaType=='Other' and ext.lower() not in ['.gif','.jpg','.png','.svg','.jpeg']: + filelist.append(tmpurl) return filelist - def get_thumb(self, media_table, linked_id): + def get_thumb(self, media_table, linked_id, MediaType=None): filelist = list() curpath = self.get_mediapath(media_table, linked_id, None) curpath = os.path.join( curpath, 'thumbnails') if not os.path.isdir(curpath): return list() for f in os.listdir(curpath): + filename, ext = os.path.splitext( f ) if os.path.isdir(os.path.join(curpath,f)): continue if f.endswith('.type'): continue if f: tmpurl = '/image/%s/%d/thumbnails/%s' % (media_table, linked_id, f) - filelist.append(tmpurl) + if MediaType is None: + filelist.append(tmpurl) + elif MediaType=='Image' and len( os.path.splitext(filename)[1] )==0: + filelist.append(tmpurl) + elif MediaType=='Other' and len( os.path.splitext(filename)[1] ): + filelist.append(tmpurl) return filelist def get_mediapath(self, media_table, linked_id, name):