[Hejes-devel] [932] blog/manage: slug field: check it valid slug and if not in database already (posts.slug)

hejes-devel at nytud.hu hejes-devel at nytud.hu
Wed Sep 11 16:44:34 CEST 2013


Revision: 932
Author:   mihaltz
Date:     2013-09-11 16:44:34 +0200 (Wed, 11 Sep 2013)
Log Message:
-----------
blog/manage: slug field: check it valid slug and if not in database already (posts.slug)

Modified Paths:
--------------
    trunk/web2py/applications/helyesiras_webdev/models/dbblog.py

Modified: trunk/web2py/applications/helyesiras_webdev/models/dbblog.py
===================================================================
--- trunk/web2py/applications/helyesiras_webdev/models/dbblog.py	2013-09-11 14:02:34 UTC (rev 931)
+++ trunk/web2py/applications/helyesiras_webdev/models/dbblog.py	2013-09-11 14:44:34 UTC (rev 932)
@@ -121,11 +121,10 @@
   migrate='blog_posts.table'
   )    
 
-dbblog.posts.slug.requires = IS_NOT_EMPTY()
+dbblog.posts.slug.requires = [IS_SLUG(), IS_NOT_IN_DB(dbblog, dbblog.posts.slug)]
 dbblog.posts.title.requires = IS_NOT_EMPTY()
 dbblog.posts.image_filename.requires = IS_IN_SET(list_image_files('applications/'+URL('static', 'blog')))
 dbblog.posts.body.requires = IS_NOT_EMPTY()
-dbblog.posts.slug.requires = IS_NOT_EMPTY()
 dbblog.posts.category.requires = IS_IN_DB(dbblog, dbblog.categories.id, '%(name)s')
 dbblog.posts.tags.requires = IS_LIST_OF(IS_LOWER())
 




More information about the Hejes-devel mailing list