Change to use wechat_only of django_we

Brightcells 7 anos atrás
pai
commit
e3871377b6
5 arquivos alterados com 8 adições e 4 exclusões
  1. 0 2
      course/decorators.py
  2. 2 0
      page/code_views.py
  3. 2 0
      page/info_views.py
  4. 2 0
      page/list_views.py
  5. 2 2
      requirements.txt

+ 0 - 2
course/decorators.py

@@ -16,8 +16,6 @@ def check_token(func=None):
16 16
         def returned_wrapper(request, *args, **kwargs):
17 17
             vtoken = request.GET.get('vtoken', '') or request.POST.get('vtoken', '')
18 18
             if not settings.DEBUG:
19
-                if not request.wechat:
20
-                    return render(request, 'django_we/errmsg.html', {'title': '错误', 'errmsg': '请在微信中打开'})
21 19
                 token_check_key = request.GET.get(settings.TOKEN_CHECK_KEY, '') or request.POST.get(settings.TOKEN_CHECK_KEY, '')
22 20
                 if not r.token_exists(token_check_key, vtoken):
23 21
                     # 3rd OAuth

+ 2 - 0
page/code_views.py

@@ -6,6 +6,7 @@ from django.conf import settings
6 6
 from django.core.urlresolvers import reverse
7 7
 from django.db import transaction
8 8
 from django.shortcuts import redirect, render
9
+from django_we.decorators import wechat_only
9 10
 from furl import furl
10 11
 
11 12
 from account.models import UserInfo
@@ -15,6 +16,7 @@ from utils.error.errno_utils import CourseCodeStatusCode, ProfileStatusCode
15 16
 from utils.error.response_utils import response
16 17
 
17 18
 
19
+@wechat_only
18 20
 @check_token
19 21
 @transaction.atomic
20 22
 def course_code(request):

+ 2 - 0
page/info_views.py

@@ -4,6 +4,7 @@ from __future__ import division
4 4
 
5 5
 from django.conf import settings
6 6
 from django.shortcuts import render
7
+from django_we.decorators import wechat_only
7 8
 
8 9
 from account.models import UserInfo
9 10
 from codes.models import CourseCodeInfo
@@ -13,6 +14,7 @@ from utils.error.errno_utils import CourseCodeStatusCode, CourseStatusCode, Prof
13 14
 from utils.error.response_utils import response
14 15
 
15 16
 
17
+@wechat_only
16 18
 @check_token
17 19
 def course_info(request):
18 20
     user_id = request.GET.get('user_id', '')

+ 2 - 0
page/list_views.py

@@ -4,6 +4,7 @@ from __future__ import division
4 4
 
5 5
 from django.conf import settings
6 6
 from django.shortcuts import render
7
+from django_we.decorators import wechat_only
7 8
 
8 9
 from account.models import UserInfo
9 10
 from codes.models import CourseCodeInfo
@@ -13,6 +14,7 @@ from utils.error.errno_utils import CourseCodeStatusCode, ProfileStatusCode
13 14
 from utils.error.response_utils import response
14 15
 
15 16
 
17
+@wechat_only
16 18
 @check_token
17 19
 def course_list(request):
18 20
     user_id = request.GET.get('user_id', '')

+ 2 - 2
requirements.txt

@@ -20,7 +20,7 @@ django-rlog==1.0.7
20 20
 django-shortuuidfield==0.1.3
21 21
 django-six==1.0.4
22 22
 django-uniapi==1.0.0
23
-django-we==1.0.16
23
+django-we==1.0.19
24 24
 djangorestframework==3.7.3
25 25
 furl==1.0.1
26 26
 hiredis==0.2.0
@@ -33,7 +33,7 @@ pywe-oauth==1.0.5
33 33
 pywe-response==1.0.1
34 34
 qiniu==7.1.9
35 35
 redis==2.10.6
36
-redis-extensions==1.1.3
36
+redis-extensions==1.1.4
37 37
 requests==2.18.4
38 38
 rlog==0.3
39 39
 shortuuid==0.5.0