Source

article / article / models.py

Diff from to

article/models.py

     if obj.is_published and obj.published_on is None:
         obj.published_on = datetime.now()
 
+def post_tag_check(sender, **kwargs):
+    obj = kwargs['instance']
+    if obj.post_tags:
+        from string import strip
+        obj.post_tags = strip(obj.post_tags)
+
+def recipe_tag_check(sender, **kwargs):
+    obj = kwargs['instance']
+    if obj.rec_tags:
+        from string import strip
+        obj.rec_tags = strip(obj.rec_tags)
+
 pre_save.connect(pub_date_check, sender=Post)
+pre_save.connect(post_tag_check, sender=Post)
 pre_save.connect(pub_date_check, sender=Recipe)
+pre_save.connect(recipe_tag_check, sender=Recipe)
 
 try:
     tagging.register(Post)