Permalink
Browse files

Work on third calculator and other things

  • Loading branch information...
1 parent bb3b21b commit 10da097057cd8c07ddfb3743bcb08330e5190075 @Guest007 committed Feb 24, 2014
Showing with 627 additions and 153 deletions.
  1. +2 −0 eurocard/urls.py
  2. +24 −16 orders/views.py
  3. +394 −55 templates/article.html
  4. +16 −2 templates/contacts.html
  5. +5 −25 templates/layout.html
  6. +5 −9 templates/prod.html
  7. +35 −3 theme/css/template.css
  8. +41 −4 theme/css/template.less
  9. +105 −39 theme/js/init.js
View
@@ -36,6 +36,8 @@
url(r"^(?P<pk>\d+)/$", orders.edit_fast, name="edit-fast"),
url(r"^(?P<pk>\d+)/(?P<step>\d+)/$", orders.edit_easy, name="edit-easy"),
url(r"^(?P<pk>\d+)/$", orders.edit_easy, name="edit-easy"),
+ url(r"^(?P<pk>\d+)/(?P<step>\d+)/$", orders.edit_templ, name="edit-templ"),
+ url(r"^(?P<pk>\d+)/$", orders.edit_templ, name="edit-templ"),
url(r"^uploadfile/", orders.ajax_save, name="uploadfile"),
url(r"^save/ajax/(?P<step>\d+)/$", orders.save_order, name="ajax-save-order"),
url(r"^save/templ/(?P<step>\d+)/$", orders.save_order1, name="ajax-save-torder"),
View
@@ -92,6 +92,18 @@ def edit_easy(request, pk, step=0):
'color_back': Color.objects.all().order_by('-id')}
+@render_to()
+def edit_templ(request, pk, step=0):
+ """Edit selected Order"""
+ if step == 0:
+ return http.HttpResponseRedirect('1/')
+ order = get_object_or_404(Orders, pk=int(pk))
+ templ = OrderTemplate.objects.get(id=order.template.id)
+ return {"TEMPLATE": 'ready-form.html',
+ "object": order,
+ "templ": templ}
+
+
@csrf_protect
def nextstep_order(request, pk):
"""Final confirm of Order"""
@@ -286,16 +298,21 @@ def save_order1(request, step=1):
except (TypeError, ValueError):
id = 0
+ print request.POST
+
time = datetime.datetime.now()
templ = OrderTemplate.objects.get(id=id)
price = templ.price
print price
- templ.pk = 0
+
+ templ.pk = None
+ # templ.id = 0
templ.is_template = False
templ.name = str(time) + " " + templ.name
templ.price = None
templ.save() # взяли шаблон по id, обрали признак шаблона и скопировали.
+ print "1234", templ.pk
order = Orders(template=templ)
draw = request.POST.get("count", None)
@@ -311,22 +328,13 @@ def save_order1(request, step=1):
# user = request.POST.get("user", None)
# phone = request.POST.get("phone", None)
# email = request.POST.get("email", None)
+ step = 2
- if step == '1':
- result = {"result": "OK", "id": order.id,
- "msg": "Changes are saved",
- "url": reverse("edit-order", args=[order.id, 3])}
- return HttpResponse(json.dumps(result),
- content_type="application/json")
- elif step > 10:
- result = {"result": "OK", "id": order.id, "msg": "This case 'elif step > 10'",
- "url": reverse("edit-easy", args=[order.id, step])}
- return HttpResponse(json.dumps(result),
- content_type="application/json")
- else:
- result = {"result": "OK", "id": order.id, "msg": "This case 'else'",
- "url": reverse("edit-fast", args=[order.id, step])}
- return HttpResponse(json.dumps(result),
+
+ result = {"result": "OK", "id": order.id,
+ "msg": "Changes are saved",
+ "url": reverse("edit-templ", args=[order.pk, 3])}
+ return HttpResponse(json.dumps(result),
content_type="application/json")
Oops, something went wrong.

0 comments on commit 10da097

Please sign in to comment.