From 9df505da5b242eb2028835ee71b6d96c680683a1 Mon Sep 17 00:00:00 2001 From: tr4ck3ur Date: Sun, 1 Oct 2017 12:58:32 +0200 Subject: [PATCH] fix missing slug on place table --- jm2l/upload.py | 3 ++- jm2l/views.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/jm2l/upload.py b/jm2l/upload.py index e4c9630..c5a8dcd 100644 --- a/jm2l/upload.py +++ b/jm2l/upload.py @@ -14,6 +14,7 @@ import cStringIO as StringIO from .models import User, Place, Tiers, Event, SallePhy from .blenderthumbnailer import blend_extract_thumb, write_png from jm2l.const import CurrentYear +from slugify import slugify MIN_FILE_SIZE = 1 # bytes MAX_FILE_SIZE = 500000000 # bytes @@ -128,7 +129,7 @@ class MediaPath(): if media_table=='tiers': slug = Tiers.by_id(linked_id).slug if media_table=='place': - slug = Place.by_id(linked_id).slug + slug = Place.by_id(linked_id).slug or slugify(Place.by_id(linked_id).name) if media_table=='salle': slug = SallePhy.by_id(linked_id).slug p = IMAGEPATH + [ media_table, slug ] diff --git a/jm2l/views.py b/jm2l/views.py index 6ba78f8..b2f6fe0 100644 --- a/jm2l/views.py +++ b/jm2l/views.py @@ -1179,6 +1179,7 @@ def Modal(request): if request.method == 'POST' and form.validate(): form.populate_obj(place) place.created_by=request.user.uid + place.slug = slugify(place.name) if uid>0: DBSession.merge(place) else: