Skip to content
Browse files

try with mail-send

and with tiote
  • Loading branch information...
1 parent 081ddd5 commit 74c1c53e379f3952d79d03e248ef28550e6277cd @Guest007 committed Feb 21, 2014
Showing with 62 additions and 7 deletions.
  1. +2 −0 eurocard/settings.py
  2. +13 −2 eurocard/urls.py
  3. +24 −1 orders/views.py
  4. +2 −0 requirements.txt
  5. +21 −4 templates/layout.html
View
2 eurocard/settings.py
@@ -45,6 +45,8 @@
'menu',
'articles',
'orders',
+ "mailshelf",
+ "tiote",
)
MIDDLEWARE_CLASSES = (
View
15 eurocard/urls.py
@@ -10,7 +10,7 @@
from filebrowser.sites import site
from orders.views import save_order
# from django.views.generic.simple import direct_to_template
-
+from django.conf.urls import patterns, include, url
admin.autodiscover()
urlpatterns = patterns('',
@@ -23,11 +23,13 @@
url(r'^price/', views.price, name='price'),
url(r'^cooperation/', views.cooperation, name='cooperation'),
url(r'^contacts/', views.contacts, name='contacts'),
+
+ # Ajax actions
url(r'^form_2/', orders.fastform, name='f_order'),
url(r'^form_1/', orders.easyform, name='e_order'),
url(r'^form_3/', orders.readyform, name='r_order'),
+ url(r'^call-back/', orders.callback, name='call-back'),
- # Ajax actions
url(r"^second/(?P<pk>\d+)/$", orders.nextstep_order, name="ajax-nextstep-order"),
url(r"^(?P<pk>\d+)/(?P<step>\d+)/$", orders.edit_fast, name="edit-fast"),
url(r"^(?P<pk>\d+)/$", orders.edit_fast, name="edit-fast"),
@@ -38,6 +40,15 @@
url(r'^test/', views.test, name='test'),
+ # url(r'^tiote/', include('tiote.urls')),
+
+
+# urlpatterns = patterns('',
+ (r'^tiote/$', 'tiote.views.start.index'),
+ (r'^tiote/ajax/$', 'tiote.views.start.ajax'),
+ (r'^tiote/login/$', 'tiote.views.start.login'),
+# )
+
url(r'^grappelli/', include('grappelli.urls')),
url(r'^admin/filebrowser/', include(site.urls)),
url(r'^admin/', include(admin.site.urls)),
View
25 orders/views.py
@@ -14,7 +14,8 @@
from django.views.decorators.csrf import csrf_exempt, csrf_protect, ensure_csrf_cookie, requires_csrf_token
from django import http
from django.http import HttpResponse
-
+from mailshelf import messages
+from config.models import Settings
__author__ = 'guest007'
@@ -270,5 +271,27 @@ def save_order(request, step=1):
content_type="application/json")
+@csrf_exempt
+def callback(request):
+ name = request.POST.get('fio', False)
+ phone = request.POST.get('phone', False)
+ message = request.POST.get('message', '')
+ time = datetime.datetime.now()
+ email = Settings.objects.get(slug='callback-mail')
+ print email.content
+ try:
+ messages.CALL_BACK.send(email,
+ **{
+ 'name': name,
+ 'phone': phone,
+ 'message': message,
+ 'time': time
+ })
+ print "SENT"
+ except:
+ pass
+
+ response = http.HttpResponse('OK', content_type="text/html; charset=utf-8")
+ return response
View
2 requirements.txt
@@ -6,3 +6,5 @@ django-filebrowser
django-debug-toolbar
django-menu
django-annoying==0.7.7
+-e hg+https://bitbucket.org/anger/django-mailshelf@08649fb461d126d17b8569c2a763e5db835d6e1a#egg=django_mailshelf-dev
+tiote
View
25 templates/layout.html
@@ -30,18 +30,35 @@
<a href="#">Заказать обратный звонок
</a>
- <form class="call hide">
+ <form id="call_back" class="call hide" method="post" action="/call-back/">
<span>Заказ звонка<small><i class="fa fa-times"></i></small></span>
<small><i class="fa fa-asterisk"></i></small>
- <input type="text" placeholder="ФИО">
+ <input type="text" name="fio" placeholder="ФИО">
<small class="phone"><i class="fa fa-asterisk"></i></small>
- <input type="text" placeholder="Телефон">
- <textarea placeholder="Сообщение"></textarea>
+ <input type="text" name="phone" placeholder="Телефон">
+ <textarea name="message" placeholder="Сообщение"></textarea>
<input type="submit" value="Отправить">
</form>
</section>
<nav>
<ul>
+
+<script type="application/javascript">
+$('#call_back').submit(function(){
+ var action = $(this).attr('action');
+ var that = $(this);
+ $.ajax({
+ url: action,
+ type: 'POST',
+ data: that.serialize(),
+ complete: function(result){
+ $('#call_back').trigger( 'reset' );
+ $('#call_back').addClass('hide');
+ }
+ });
+ return false;
+ });
+</script>
{% load menubuilder %}
{% menu main_menu %}

0 comments on commit 74c1c53

Please sign in to comment.
Something went wrong with that request. Please try again.