slugify to a max of 50 and remove date
This commit is contained in:
@@ -33,7 +33,7 @@ def thread(thread_id, slug):
|
||||
if not thread:
|
||||
abort(404)
|
||||
if thread.slug != slug:
|
||||
return redirect(url_for('.thread', thread_id=thread_id, slug=thread.slug, **request.kwargs))
|
||||
return redirect(url_for('.thread', thread_id=thread_id, slug=thread.slug, **request.args))
|
||||
|
||||
topic = Topics.find({'id': thread.topic_id})
|
||||
started_by = Users.find({'id': thread.user_id})
|
||||
@@ -115,7 +115,8 @@ def edit_post(thread_id):
|
||||
abort(400)
|
||||
|
||||
if new_title != thread.title:
|
||||
thread.update({'title': new_title})
|
||||
from slugify import slugify
|
||||
thread.update({'title': new_title, 'slug': slugify(new_title, max_length=50)})
|
||||
|
||||
return redirect(url_for('.thread_by_id', thread_id=thread_id))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user