ciclos

commit 916f7e276d2fafe1183e76997433dfa61cf2d1f1

Author: Pedro Lucas Porcellis <pedrolucasporcellis@gmail.com>

Always redirect to the cycle page

 src/blueprints/orders.py | 7 ++++---


diff --git a/src/blueprints/orders.py b/src/blueprints/orders.py
index a8e8f0d5df5267363c7b2ec980eab19b178241fb..c753fc04f9fc494ab058041c0d156f9d57edc4b6 100644
--- a/src/blueprints/orders.py
+++ b/src/blueprints/orders.py
@@ -8,8 +8,8 @@ orders = Blueprint('orders', __name__, url_prefix = '/orders')
 
 @orders.route('/')
 def create():
-    current_cycle = Cycle.query.filter_by(status = CycleStatus.published).first()
-    
+    current_cycle = Cycle.query.filter_by(status = CycleStatus.published).first() 
+ 
     if not current_cycle:
         return '', 401
 
@@ -20,9 +20,10 @@ @orders.route('/', methods = ['POST'])
 def update(id):
     order = Order.query.filter_by(id = id).first()
 
+    current_cycle = Cycle.query.filter_by(status = CycleStatus.published).first()
     if not order:
         order = Order.create_for(current_user, current_cycle)
     
     order.add_products(request.form.getlist('product_ids'))
 
-    return order.to_json()
+    return redirect(url_for('cycles.show', id = current_cycle.id))