fix missing slug on place table
This commit is contained in:
+2
-1
@@ -14,6 +14,7 @@ import cStringIO as StringIO
|
|||||||
from .models import User, Place, Tiers, Event, SallePhy
|
from .models import User, Place, Tiers, Event, SallePhy
|
||||||
from .blenderthumbnailer import blend_extract_thumb, write_png
|
from .blenderthumbnailer import blend_extract_thumb, write_png
|
||||||
from jm2l.const import CurrentYear
|
from jm2l.const import CurrentYear
|
||||||
|
from slugify import slugify
|
||||||
|
|
||||||
MIN_FILE_SIZE = 1 # bytes
|
MIN_FILE_SIZE = 1 # bytes
|
||||||
MAX_FILE_SIZE = 500000000 # bytes
|
MAX_FILE_SIZE = 500000000 # bytes
|
||||||
@@ -128,7 +129,7 @@ class MediaPath():
|
|||||||
if media_table=='tiers':
|
if media_table=='tiers':
|
||||||
slug = Tiers.by_id(linked_id).slug
|
slug = Tiers.by_id(linked_id).slug
|
||||||
if media_table=='place':
|
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':
|
if media_table=='salle':
|
||||||
slug = SallePhy.by_id(linked_id).slug
|
slug = SallePhy.by_id(linked_id).slug
|
||||||
p = IMAGEPATH + [ media_table, slug ]
|
p = IMAGEPATH + [ media_table, slug ]
|
||||||
|
|||||||
@@ -1179,6 +1179,7 @@ def Modal(request):
|
|||||||
if request.method == 'POST' and form.validate():
|
if request.method == 'POST' and form.validate():
|
||||||
form.populate_obj(place)
|
form.populate_obj(place)
|
||||||
place.created_by=request.user.uid
|
place.created_by=request.user.uid
|
||||||
|
place.slug = slugify(place.name)
|
||||||
if uid>0:
|
if uid>0:
|
||||||
DBSession.merge(place)
|
DBSession.merge(place)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user