Indent properly.
authorAditi <aditi.iitr@gmail.com>
Sat, 20 Jul 2013 05:31:52 +0000 (11:01 +0530)
committerAditi <aditi.iitr@gmail.com>
Sat, 20 Jul 2013 05:31:52 +0000 (11:01 +0530)
mediagoblin/media_types/blog/views.py
mediagoblin/templates/mediagoblin/blog/blog_edit_create.html

index 885594b1b7cb8344467c061a12784263a2c97550..a48e65e0f6de6e7788f6aaa53eb59eeb7981fee0 100644 (file)
@@ -102,49 +102,49 @@ def blog_edit(request):
                      'app_config': mg_globals.app_config})
         else:
             if request.method == 'POST' and form.validate():
-                       blog.title = unicode(form.title.data)
-                       blog.description = unicode(form.description.data)
-                       blog.author = request.user.id
-                       blog.generate_slug()
-                       
-                       blog.save()
-                       add_message(request, SUCCESS, "Your blog is updated.")
-            return redirect(request, "mediagoblin.user_pages.user_home",
-                        user=request.user.username)            
-        
+                blog.title = unicode(form.title.data)
+                blog.description = unicode(form.description.data)
+                blog.author = request.user.id
+                blog.generate_slug()
+                
+                blog.save()
+                add_message(request, SUCCESS, "Your blog is updated.")
+                return redirect(request, "mediagoblin.user_pages.user_home",
+                            user=request.user.username)            
+            
 @require_active_login        
 def blogpost_create(request):
-       form = blog_forms.BlogPostEditForm(request.form, license=request.user.license_preference)
-       
-       if request.method == 'POST' and form.validate():
-               blogpost = MediaEntry()
-               blogpost.media_type = 'blog_post'
-               blogpost.title = unicode(form.title.data)
-               blogpost.description = unicode(form.description.data)
-               blogpost.tags =  convert_to_tag_list_of_dicts(form.tags.data)
-               blogpost.license = unicode(form.license.data) or None
-               blogpost.uploader = request.user.id
-               #blogpost.state = 'processed'
-               
-               blogpost.generate_slug()
-               
-               blogpost.save()
-       
-               add_message(request, SUCCESS, _('Woohoo! Submitted!'))
-               add_comment_subscription(request.user, blogpost)
-               return redirect(request, "mediagoblin.user_pages.user_home", 
-                       user=request.user.username)
-               
-       return render_to_response(
+    form = blog_forms.BlogPostEditForm(request.form, license=request.user.license_preference)
+    
+    if request.method == 'POST' and form.validate():
+        blogpost = MediaEntry()
+        blogpost.media_type = 'blog_post'
+        blogpost.title = unicode(form.title.data)
+        blogpost.description = unicode(form.description.data)
+        blogpost.tags =  convert_to_tag_list_of_dicts(form.tags.data)
+        blogpost.license = unicode(form.license.data) or None
+        blogpost.uploader = request.user.id
+        #blogpost.state = 'processed'
+        
+        blogpost.generate_slug()
+        
+        blogpost.save()
+    
+        add_message(request, SUCCESS, _('Woohoo! Submitted!'))
+        add_comment_subscription(request.user, blogpost)
+        return redirect(request, "mediagoblin.user_pages.user_home", 
+            user=request.user.username)
+        
+    return render_to_response(
         request,
         'mediagoblin/blog/blog_post_edit_create.html',
         {'form': form,
         'app_config': mg_globals.app_config,
         'user': request.user.username})
-       
-               
-               
-       
-                   
+    
+        
+        
+    
+                
             
     
index 385e1417e6396f153a27d9374627dfda34ab1813..7f9b0cb5558a9c3e16d8c09516f8f0f067a6b5d9 100644 (file)
@@ -24,7 +24,7 @@
         method="POST" enctype="multipart/form-data">
     <div class="form_box_xl">
       <h1>{% trans %}Create/Edit a Blog{% endtrans %}</h1>
-      {{ wtforms_util.render_divs(blog_form) }}
+      {{ wtforms_util.render_divs(form) }}
       <div class="form_submit_buttons">
         {{ csrf_token }}
         <input type="submit" value="{% trans %}Add{% endtrans %}" class="button_form" />