@@ -16,8 +16,8 @@ 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': '请在微信中打开'})
|
|
| 19 |
+ #if not request.wechat: |
|
| 20 |
+ # return render(request, 'django_we/errmsg.html', {'title': '错误', 'errmsg': '请在微信中打开'})
|
|
| 21 | 21 |
token_check_key = request.GET.get(settings.TOKEN_CHECK_KEY, '') or request.POST.get(settings.TOKEN_CHECK_KEY, '') |
| 22 | 22 |
if not r.token_exists(token_check_key, vtoken): |
| 23 | 23 |
# 3rd OAuth |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 |
wxconfig: 'https://pai.ai/we/jsapi_signature', |
| 4 | 4 |
callback: 'callback' |
| 5 | 5 |
}, wxData = {
|
| 6 |
- debug: true, |
|
| 6 |
+ debug: false, |
|
| 7 | 7 |
imgUrl: '', |
| 8 | 8 |
link: '', |
| 9 | 9 |
desc: '', |
@@ -7,7 +7,7 @@ from courses.models import CourseInfo, CourseVideoInfo |
||
| 7 | 7 |
|
| 8 | 8 |
|
| 9 | 9 |
class CourseInfoAdmin(ExportExcelModelAdmin, admin.ModelAdmin): |
| 10 |
- list_display = ('course_id', 'course_name', 'course_time', 'course_cover', 'status', 'created_at', 'updated_at')
|
|
| 10 |
+ list_display = ('course_id', 'course_name', 'course_time', 'course_cover', 'course_position', 'status', 'created_at', 'updated_at')
|
|
| 11 | 11 |
list_filter = ('status', )
|
| 12 | 12 |
|
| 13 | 13 |
|
@@ -0,0 +1,20 @@ |
||
| 1 |
+# -*- coding: utf-8 -*- |
|
| 2 |
+# Generated by Django 1.11.3 on 2017-09-26 08:03 |
|
| 3 |
+from __future__ import unicode_literals |
|
| 4 |
+ |
|
| 5 |
+from django.db import migrations, models |
|
| 6 |
+ |
|
| 7 |
+ |
|
| 8 |
+class Migration(migrations.Migration): |
|
| 9 |
+ |
|
| 10 |
+ dependencies = [ |
|
| 11 |
+ ('courses', '0002_coursevideoinfo_course_video'),
|
|
| 12 |
+ ] |
|
| 13 |
+ |
|
| 14 |
+ operations = [ |
|
| 15 |
+ migrations.AddField( |
|
| 16 |
+ model_name='courseinfo', |
|
| 17 |
+ name='course_position', |
|
| 18 |
+ field=models.IntegerField(default=0, help_text='\u8bfe\u7a0b\u6392\u5e8f', verbose_name='course_position'), |
|
| 19 |
+ ), |
|
| 20 |
+ ] |
@@ -24,6 +24,7 @@ class CourseInfo(CreateUpdateMixin): |
||
| 24 | 24 |
course_name = models.CharField(_(u'course_name'), max_length=255, blank=True, null=True, help_text=u'课程标题') |
| 25 | 25 |
course_time = models.IntegerField(_(u'course_time'), default=0, help_text=u'课程时间') |
| 26 | 26 |
course_cover = models.ImageField(_(u'course_cover'), upload_to=upload_path, blank=True, null=True, help_text=u'课程视频缩略图') |
| 27 |
+ course_position = models.IntegerField(_(u'course_position'), default=0, help_text=u'课程排序') |
|
| 27 | 28 |
|
| 28 | 29 |
class Meta: |
| 29 | 30 |
verbose_name = _(u'courseinfo') |
@@ -27,7 +27,7 @@ def course_list(request): |
||
| 27 | 27 |
except CourseCodeInfo.DoesNotExist: |
| 28 | 28 |
response(CourseCodeStatusCode.COURSE_CODE_NOT_FOUND) |
| 29 | 29 |
|
| 30 |
- courses = CourseInfo.objects.filter(status=True) |
|
| 30 |
+ courses = CourseInfo.objects.filter(status=True).order_by('course_position')
|
|
| 31 | 31 |
courses = [course.data for course in courses] |
| 32 | 32 |
|
| 33 | 33 |
return render(request, 'page/course_list.html', {
|