husong 7 роки тому
батько
коміт
9e5a73621c

BIN
common/admin.pyc


+ 1 - 1
common/common.py

@@ -25,7 +25,7 @@ def params(func):
             else:
                 request.PARAMS = request.POST
         elif request.method == "OPTIONS":
-            return JsonResponse({"code": 0, "msg": "success"})
+            return JsonResponse({"code": 0, "msg": "success11"})
         else:
             request.PARAMS = {}
         return func(*args, **kargs)

BIN
common/common.pyc


BIN
common/migrations/__init__.pyc


BIN
common/models.pyc


+ 28 - 0
content_manage/migrations/0005_banner.py

@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('content_manage', '0004_auto_20171116_1253'),
+    ]
+
+    operations = [
+        migrations.CreateModel(
+            name='Banner',
+            fields=[
+                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+                ('position', models.IntegerField(default=1, verbose_name='\u6a2a\u5e45\u4f4d\u7f6e')),
+                ('img_url', models.URLField(default=b'', null=True, verbose_name='\u56fe\u7247url')),
+                ('display_title', models.CharField(help_text='\u4e0d\u8d85\u8fc764\u4e2a\u5b57', max_length=128, verbose_name='\u5c55\u793a\u6807\u9898')),
+                ('article_url', models.URLField(default=b'', null=True, verbose_name='\u6587\u7ae0url')),
+                ('article_title', models.CharField(help_text='\u4e0d\u8d85\u8fc764\u4e2a\u5b57', max_length=128, verbose_name='\u6587\u7ae0\u6807\u9898')),
+                ('author', models.CharField(default=b'', max_length=32, null=True, verbose_name='\u6587\u7ae0\u4f5c\u8005', blank=True)),
+                ('content', models.TextField(default=b'', null=True, verbose_name='\u6587\u7ae0\u5185\u5bb9', blank=True)),
+                ('create_time', models.DateField(auto_now_add=True)),
+            ],
+        ),
+    ]

BIN
content_manage/migrations/0005_banner.pyc


+ 25 - 0
content_manage/migrations/0006_news.py

@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('content_manage', '0005_banner'),
+    ]
+
+    operations = [
+        migrations.CreateModel(
+            name='News',
+            fields=[
+                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+                ('title', models.CharField(help_text='\u4e0d\u8d85\u8fc764\u4e2a\u5b57', max_length=128, verbose_name='\u6587\u7ae0\u6807\u9898')),
+                ('img_url', models.URLField(default=b'', null=True, verbose_name='\u56fe\u7247url')),
+                ('author', models.CharField(default=b'', max_length=32, null=True, verbose_name='\u6587\u7ae0\u4f5c\u8005', blank=True)),
+                ('content', models.TextField(default=b'', null=True, verbose_name='\u6587\u7ae0\u5185\u5bb9', blank=True)),
+                ('create_time', models.DateField(auto_now_add=True)),
+            ],
+        ),
+    ]

BIN
content_manage/migrations/0006_news.pyc


+ 26 - 0
content_manage/models.py

@@ -28,3 +28,29 @@ class Article(models.Model):
     img_url = models.URLField(u"图片url", null=True, default="")
     type = models.SmallIntegerField(u"文章分类", default=0, choices=COMMENT_TYPE)
     content = models.TextField(u"文章内容",default="", blank=True,null=True)
+
+
+
+class Banner(models.Model):
+    """
+    横幅内容表
+    """
+    position = models.IntegerField(u"横幅位置",default=1)
+    img_url = models.URLField(u"图片url", null=True, default="")
+    display_title = models.CharField(u"展示标题",max_length=128, help_text=u"不超过64个字")
+    article_url = models.URLField(u"文章url", null=True, default="")
+    article_title = models.CharField(u"文章标题",max_length=128, help_text=u"不超过64个字")
+    author = models.CharField(u"文章作者", max_length=32, blank=True,null=True,default="")
+    content = models.TextField(u"文章内容",default="", blank=True,null=True)
+    create_time = models.DateField(auto_now_add=True)
+
+
+class News(models.Model):
+    """
+    横幅内容表
+    """
+    title = models.CharField(u"文章标题",max_length=128, help_text=u"不超过64个字")
+    img_url = models.URLField(u"图片url", null=True, default="")
+    author = models.CharField(u"文章作者", max_length=32, blank=True,null=True,default="")
+    content = models.TextField(u"文章内容",default="", blank=True,null=True)
+    create_time = models.DateField(auto_now_add=True)

BIN
content_manage/models.pyc


+ 224 - 7
content_manage/views.py

@@ -1,4 +1,5 @@
 # -*-coding:utf-8 -*-
+import traceback
 from common.common import (get_user_from_request, login_required,
                            params,JsonResponse)
 from django.views.decorators.csrf import csrf_exempt
@@ -37,25 +38,241 @@ def content_show(request,offset):
 def content_edit(request,offset):
 
     data = request.PARAMS
-    # if not data:
-    #     return JsonResponse({"code": -1, "msg": u"参数不完整"})
+    if not data:
+        return JsonResponse({"code": -1, "msg": u"参数不完整"})
 
     title = data.get("title",None)
     img_url = data.get("img_url",None)
     content = data.get("content",None)
-    page_type = data.get("page_type",None)
+    # page_type = data.get("page_type",None)
 
-    # title = "ssssss"
-    # content = "gggggg"
-    obj = Article.objects.get(type=int(offset))
 
+    obj = Article.objects.filter(type=int(offset)).first()
+    print("ccccccc",obj)
     if obj:
         obj.title = title
         obj.img_url = img_url
         obj.content = content
         obj.save()
-        res = {"code":0, "page_type":page_type, "content":content}
+        res = {"code":0, "msg":"sucess",}
     else:
         res = {"code":-1, "msg":"编辑失败"}
+    print(res)
+    return JsonResponse(res)
+
+
+
+
+@csrf_exempt
+# @params
+def banner_show(request):
+    """
+    横幅展示
+    return data list
+    """
+    objs = Banner.objects.all()
+    if objs:
+        data_list=[]
+        for obj_banner in objs:
+            dict_data={}
+            dict_data["bid"] = obj_banner.id
+            dict_data["display_title"] = obj_banner.display_title
+            dict_data["create_time"] = obj_banner.create_time
+            dict_data["position"] = obj_banner.position
+            data_list.append(dict_data)
+        res = {"code":0,"msg":"get data sucess!","content_data":data_list}
+    else:
+        res = {"code":-1,"msg":"get no data",}
+
+    return JsonResponse(res)
+
+@csrf_exempt
+@params
+def banner_add(request):
+    """
+    添加横幅内容
+    """
+    req_params = request.PARAMS
+    if req_params:
+        try:
+            position = req_params.get("position",None)
+            img_url = req_params.get("img_url",None)
+            display_title = req_params.get("display_title",None)
+            article_url = req_params.get("article_url",None)
+            article_title = req_params.get("article_title",None)
+            author = req_params.get("author",None)
+            content = req_params.get("content",None)
+
+            obj= Banner.objects.create(position=position,img_url=img_url,display_title=display_title,
+                article_url=article_url,article_title=article_title,author=author,content=content)
+            res = res={"code": 0, "msg": "banner add sucess"}
+        except:
+            traceback.print_exc()
+    else:
+        res={"code": -1, "msg": u"参数不完整"}
+
+    return JsonResponse(res)
+
+@csrf_exempt
+@params
+def banner_edit(request):
+    """
+    编辑横幅内容
+    """
+    req_params = request.PARAMS
+    if req_params:
+        try:
+            bid = req_params.get("bid")
+            position = req_params.get("position",None)
+            img_url = req_params.get("img_url",None)
+            display_title = req_params.get("display_title",None)
+            article_url = req_params.get("article_url",None)
+            article_title = req_params.get("article_title",None)
+            author = req_params.get("author",None)
+            content = req_params.get("content",None)
+
+            obj= Banner.objects.filter(id=bid)
+            if obj:
+                obj.id = bid
+                obj.position = position
+                obj.img_url = img_url
+                obj.display_title = display_title
+                obj.article_url = article_url
+                obj.author = author
+                obj.content = content
+                obj.save()
+                res = {"code": 0, "msg": "banner add sucess"}
+            else:
+                res = {"code": -1, "msg": "banner add fail"}
+        except:
+            traceback.print_exc()
+    else:
+        res={"code": -1, "msg": u"参数不完整"}
+
+    return JsonResponse(res)
+
+@csrf_exempt
+@params
+def banner_delete(request):
+    """
+    删除横幅
+    """ 
+    req_params = request.PARAMS
+    if req_params:
+        try:
+            bid = req_params.get("bid")
+
+            obj= Banner.objects.filter(id=bid).first()
+            if obj:
+                obj.delete()
+                res = {"code": 0, "msg": "banner delete sucess"}
+            else:
+                res = {"code": -1, "msg": "banner delete fail"}
+        except:
+            traceback.print_exc()
+    else:
+        res={"code": -1, "msg": u"参数不完整"}
+
+    return JsonResponse(res)
+
+
+@csrf_exempt
+def news_show(request):
+    """
+    最新动态
+    return data list
+    """
+    objs = News.objects.all()
+    if objs:
+        data_list=[]
+        for obj_news in objs:
+            dict_data={}
+            dict_data["nid"] = obj_news.id
+            dict_data["title"] = obj_news.title
+            dict_data["create_time"] = obj_news.create_time
+            dict_data["author"] = obj_news.author
+            data_list.append(dict_data)
+        res = {"code":0,"msg":"show sucess!","content_data":data_list}
+    else:
+        res = {"code":-1,"msg":"no data",}
+
+    return JsonResponse(res)
+
+
+@csrf_exempt
+@params
+def news_add(request):
+    """
+    新增动态
+    """
+    req_params = request.PARAMS
+    if req_params:
+        try:
+            img_url = req_params.get("img_url",None)
+            title = req_params.get("title",None)
+            author = req_params.get("author",None)
+            content = req_params.get("content",None)
+            obj= News.objects.create(title=title,img_url=img_url,author=author,content=content)
+
+            res = res={"code": 0, "msg": "banner add sucess"}
+        except:
+            traceback.print_exc()
+    else:
+        res={"code": -1, "msg": u"参数不完整"}
+
+    return JsonResponse(res)
+
+
+
+@csrf_exempt
+@params
+def news_look(request):
+    """
+    动态查看
+    """
+    req_params = request.PARAMS
+    if req_params:
+        try:
+            dict_data = {}
+            nid = req_params.get("nid")
+            obj = News.objects.filter(id=nid).first()
+            if obj:
+                dict_data["title"] = obj.title
+                dict_data["create_time"] = obj.create_time
+                dict_data["author"] = obj.author
+                dict_data["content"] = obj.content
+                print("news_look-----",dict_data)
+                res={"code": 0, "msg": "sucess","look_data":dict_data}
+            else:
+                res={"code": -1, "msg": "get data fail"}
+        except:
+            traceback.print_exc()
+
+    else:
+        res={"code": -1, "msg": u"参数不完整"}
+    return JsonResponse(res)
+
+
+@csrf_exempt
+@params
+def news_delete(request):
+    """
+    删除横幅
+    """ 
+    req_params = request.PARAMS
+    if req_params:
+        try:
+            bid = req_params.get("nid")
+
+            obj= News.objects.filter(id=bid).first()
+            if obj:
+                obj.delete()
+                res = {"code": 0, "msg": "news delete sucess"}
+            else:
+                res = {"code": -1, "msg": "news delete fail"}
+        except:
+            traceback.print_exc()
+    else:
+        res={"code": -1, "msg": u"参数不完整"}
 
     return JsonResponse(res)

BIN
content_manage/views.pyc


+ 19 - 0
users/migrations/0008_auto_20171117_0232.py

@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('users', '0007_auto_20171116_1019'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='users',
+            name='signup_time',
+            field=models.DateField(auto_now_add=True),
+        ),
+    ]

BIN
users/migrations/0008_auto_20171117_0232.pyc


+ 19 - 0
users/migrations/0009_auto_20171117_0828.py

@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('users', '0008_auto_20171117_0232'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='reader',
+            name='fb_content',
+            field=models.TextField(default=b'', max_length=500, blank=True, help_text='\u4e0d\u8d85\u8fc7250\u5b57', null=True, verbose_name='\u95ee\u9898\u56de\u590d'),
+        ),
+    ]

BIN
users/migrations/0009_auto_20171117_0828.pyc


+ 19 - 0
users/migrations/0010_auto_20171117_0831.py

@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('users', '0009_auto_20171117_0828'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='reader',
+            name='create_time',
+            field=models.DateField(auto_now_add=True),
+        ),
+    ]

BIN
users/migrations/0010_auto_20171117_0831.pyc


+ 4 - 3
users/models.py

@@ -11,7 +11,8 @@ class Users(models.Model):
     real_name = models.CharField(u"真实姓名", max_length=32, blank=True,null=True,default="")
     status = models.IntegerField(u"状态",default=0)
     permission = models.IntegerField(u"权限",default=3)
-    signup_time = models.CharField(u"注册时间", max_length=64,blank=True,null=True,default="")
+    signup_time = models.DateField(auto_now_add=True)
+
 
     def __unicode__(self):
         return self.username
@@ -23,9 +24,9 @@ class Reader(models.Model):
     读者表
     """
     readername = models.CharField(u"读者昵称", max_length=32, blank=True, default="")
-    create_time = models.CharField(u"提问时间", max_length=64)
+    create_time = models.DateField(auto_now_add=True)
     question = models.TextField(u"问题内容",max_length=500, default="", blank=True,
                              help_text=u"不超过250字")
     fb_id = models.IntegerField(u"管理者id",blank=True,null=True)
-    fb_content = models.TextField(u"问题回复",max_length=500, default="", blank=True,
+    fb_content = models.TextField(u"问题回复",max_length=500, null=True,default="", blank=True,
                              help_text=u"不超过250字")

BIN
users/models.pyc


+ 66 - 55
users/views.py

@@ -7,6 +7,7 @@ import traceback
 # from django.core.serializers.json import DjangoJSONEncoder
 from django.contrib.auth.hashers import make_password, check_password
 from django.views.decorators.csrf import csrf_exempt
+from django.core.exceptions import ObjectDoesNotExist
 from models import *
 
 from common.common import (get_user_from_request, login_required,
@@ -27,7 +28,7 @@ def user_manage(request):
     # user = request.session.get("user", None)
     data = request.PARAMS
     search_name = data.get("search_name", None)
-    search_name = "ton"
+    # search_name = "ton"
     print("search_name",search_name)
     if search_name:
         user_data = Users.objects.filter(username__icontains=search_name)
@@ -35,7 +36,7 @@ def user_manage(request):
         user_data = Users.objects.all()
 
     print("user_manage111",user_data)
-    data =[]
+    data_show =[]
     if user_data:
         for list_data in user_data:
             dict_data = {}
@@ -44,8 +45,8 @@ def user_manage(request):
             dict_data["realname"] = list_data.real_name
             dict_data["status"] = list_data.status
             dict_data["permission"] = list_data.permission
-            data.append(dict_data)
-        res = {"code": 0, "msg": "get data success", "user_data": data}
+            data_show.append(dict_data)
+        res = {"code": 0, "msg": "get data success", "user_data": data_show}
 
     else:
         res = {"code": -1, "msg": "get no data!"}
@@ -82,12 +83,10 @@ def adduser(request):
                 obj.username = username
                 obj.real_name = real_name
                 obj.password = password
-                obj.status = status
-                obj.permission = permission
+                obj.status = int(status)
+                obj.permission = int(permission)
 
-                obj.signup_time = time.strftime("%Y-%m-%d %H:%M:%S",time.localtime())
                 obj.save()
-
                 return JsonResponse({"code": 0, "msg": u"注册成功"})
         except:
             traceback.print_exc()
@@ -103,7 +102,7 @@ def login(request):
     :return: True / False
     """
     data = request.PARAMS
-
+    print("login****",data)
     if not data:
         return JsonResponse({"code": -1, "msg": u"参数不完整"})
 
@@ -114,6 +113,7 @@ def login(request):
     try:
         user = Users.objects.get(username=username)
     except ObjectDoesNotExist:
+        print("user not exit********")
         return JsonResponse({"code": -1, "msg": u"该用户不存在"})
 
     # 检查密码是否正确
@@ -124,7 +124,7 @@ def login(request):
     print(user.username)
     print(check_res)
     if check_res:
-        user_info = {"uid": user.id, "username": user.username,"realname": user.real_name,
+        user_info = {"uid":user.id, "username": user.username,"realname": user.real_name,
                      "status": user.status, "permission": user.permission,}
 
         print("user_info",user_info)
@@ -155,7 +155,7 @@ def logout(request):
 
 
 @csrf_exempt
-# @login_required
+@login_required
 @params
 def modified_password(request):
     """
@@ -164,23 +164,27 @@ def modified_password(request):
     :return: True / False
     """
     user = get_user_from_request(request)
+    print("uuuuuuu",user)
     req_params = request.PARAMS
     old_password = req_params.get("old_password")
     new_password = req_params.get("new_password")
-
-    user_obj = Users.objects.get(id=int(user["uid"]))
-    check_old = check_password(old_password, user_obj.password)
-
-    print("mmmmmmm",check_old)
-    res = {"code": 0, "msg": "success"}
-    if check_old:
-        new_pass = make_password(new_password, None, "pbkdf2_sha256")
-        user_obj.password = new_pass
-        user_obj.save()
+    uid = user["uid"]
+    print("*****uid",uid)
+    user_obj = Users.objects.filter(id=uid).first()
+    print("-----",user_obj)
+    if user_obj:
+        check_old = check_password(old_password, user_obj.password)
+
+        print("mmmmmmm",check_old)
+        if check_old:
+            new_pass = make_password(new_password, None, "pbkdf2_sha256")
+            user_obj.password = new_pass
+            user_obj.save()
+            res = {"code": 0, "msg": "success"}
+        else:
+            res = {"code": -1, "msg": "旧密码不正确"}
     else:
-        res["code"] = -1
-        res["msg"] = u"旧密码不正确,请重新输入。"
-
+        res = {"code": 2, "msg": "没有登陆"}
     print(res)
     return JsonResponse(res)
 
@@ -195,25 +199,30 @@ def update_user(request):
     :return: True / False
     """
     req_params = request.PARAMS
-    username = req_params.get("username", None)
-
-    status = req_params.get("status")
-    permission = req_params.get("permission")
-    print "username --> ", username
-    print "status --> ", status
-    print "permission --> ", permission
+    if req_params:
+        try:
+            # username = req_params.get("username")
+            uid = req_params.get("uid")
+            status = req_params.get("status")
+            permission = req_params.get("permission")
+            print "status --> ", status
+            print "permission --> ", permission
 
-    user_obj = Users.objects.filter(username=username).first()
-    print("update-----",user_obj)
+            user_obj = Users.objects.filter(id=uid).first()
+            print("update-----",user_obj)
 
+            if user_obj:
+                user_obj.status = status
+                user_obj.permission = permission
+                user_obj.save()
+                res = {"code":0, "msg":"updte success"}
+            else:
+                res = {"code":-1, "msg":"update fail"}
+        except:
+            traceback.print_exc()
 
-    if user_obj:
-        user_obj.status = status
-        user_obj.permission = permission
-        user_obj.save()
-        res = {"code":0, "status":user_obj.status, "permission":user_obj.permission}
     else:
-        res = {"code":-1, "msg":"修改失败!"}
+        res = {"code":-1, "msg":"参数不完整"}
 
     print(res)
     return JsonResponse(res)
@@ -228,17 +237,17 @@ def delete_user(request):
     :return: True / False
     """
     req_params = request.PARAMS
-    username = req_params.get("username", None)
-
-    print "username --> ", username
+    uid = req_params.get("uid", None)
 
-    user_obj = Users.objects.filter(username=username).first()
+    user_obj = Users.objects.filter(id=uid).first()
+    print(user_obj)
     if user_obj:
         user_obj.delete()
-        res = {"code":0, "msg":"删除成功"}
+        res = {"code":0, "msg":"删除成功"}
     else:
-        res = {"code":-1, "msg":"修改失败!"}
+        res = {"code":-1, "msg":"删除失败"}
 
+    print(res)
     return JsonResponse(res)
 
 
@@ -266,13 +275,13 @@ def reader_fb(request):
             dict_data = {}
             dict_data["rid"] = list_data.id
             dict_data["readername"] = list_data.readername
-            dict_data["crete_time"] = list_data.crete_time
+            dict_data["create_time"] = list_data.create_time
             dict_data["question"] = list_data.question
             data.append(dict_data)
         res = {"code": 0, "msg": "get data success", "reader_data": data}
 
     else:
-        res = {"code": -1, "msg": "get no data!"}
+        res = {"code": -1, "msg": "get empty data!"}
 
     print(res)
     return JsonResponse(res)
@@ -280,7 +289,7 @@ def reader_fb(request):
 
 
 @csrf_exempt
-# @login_required
+@login_required
 @params
 def fb_question(request):
     """
@@ -288,25 +297,27 @@ def fb_question(request):
     :param request: rid ,content
     :return: True / False
     """
+    
+    user_id = -1
     user = get_user_from_request(request)
-    # user_id = 2
-    user_id = user["uid"]
+    if user:
+        user_id = user["uid"]
+    else:
+        return JsonResponse({"code":-1, "msg":"没登陆"})
     req_params = request.PARAMS
-    rid = req_params.get("rid", None)
+    rid = req_params.get("rid")
     fb_content = req_params.get("fb_content", None)
 
-
     reader_obj = Reader.objects.filter(id=rid).first()
     print("update-----",reader_obj)
 
-
     if reader_obj:
         reader_obj.fb_content = fb_content
         reader_obj.fb_id = user_id
         reader_obj.save()
-        res = {"code":0, "msg":"回复成功", "fb_content":fb_content}
+        res = {"code":0, "msg":"success", "fb_content":fb_content}
     else:
-        res = {"code":-1, "msg":"修改失败!"}
+        res = {"code":-1, "msg":"回复失败"}
 
     print(res)
     return JsonResponse(res)

BIN
users/views.pyc


+ 42 - 3
xdcjing/settings.py

@@ -39,14 +39,20 @@ INSTALLED_APPS = (
     'django.contrib.sessions',
     'django.contrib.messages',
     'django.contrib.staticfiles',
+    'corsheaders',
     'content_manage',
-    'users'
+    'users',
+    'common',
+
+    
 )
 
 MIDDLEWARE_CLASSES = (
     'django.contrib.sessions.middleware.SessionMiddleware',
+    'corsheaders.middleware.CorsMiddleware',
     'django.middleware.common.CommonMiddleware',
-    'django.middleware.csrf.CsrfViewMiddleware',
+
+    # 'django.middleware.csrf.CsrfViewMiddleware',
     'django.contrib.auth.middleware.AuthenticationMiddleware',
     'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
     'django.contrib.messages.middleware.MessageMiddleware',
@@ -54,6 +60,39 @@ MIDDLEWARE_CLASSES = (
     'django.middleware.security.SecurityMiddleware',
 )
 
+
+CORS_ALLOW_CREDENTIALS = True
+CORS_ORIGIN_ALLOW_ALL = True
+CORS_ORIGIN_WHITELIST = (
+    '*'
+)
+
+CORS_ALLOW_METHODS = (
+    'DELETE',
+    'GET',
+    'OPTIONS',
+    'PATCH',
+    'POST',
+    'PUT',
+    'VIEW',
+)
+
+CORS_ALLOW_HEADERS = (
+    'XMLHttpRequest',
+    'X_FILENAME',
+    'accept-encoding',
+    'authorization',
+    'content-type',
+    'dnt',
+    'origin',
+    'user-agent',
+    'x-csrftoken',
+    'x-requested-with',
+    'Pragma',
+)
+
+
+
 ROOT_URLCONF = 'xdcjing.urls'
 
 TEMPLATES = [
@@ -120,6 +159,6 @@ STATIC_URL = '/static/'
 # SESSION_COOKIE_DOMAIN = None                              # Session的cookie保存的域名
 # SESSION_COOKIE_SECURE = False                             # 是否Https传输cookie
 # SESSION_COOKIE_HTTPONLY = True                            # 是否Session的cookie只支持http传输
-SESSION_COOKIE_AGE = 30*60                              
+SESSION_COOKIE_AGE = 300*60                              
 # SESSION_EXPIRE_AT_BROWSER_CLOSE = False                   # 是否关闭浏览器使得Session过期
 # SESSION_SAVE_EVERY_REQUEST = False                        # 是否每次请求都保存Session,默认修改之后才保存

BIN
xdcjing/settings.pyc


+ 7 - 0
xdcjing/urls.py

@@ -20,5 +20,12 @@ urlpatterns = [
     url(r'^fb_question/$', users.views.fb_question),
     url(r'^content_show-([0,1,2,3,4,5])/$', content_manage.views.content_show),
     url(r'^content_edit-([0,1,2,3,4,5])/$', content_manage.views.content_edit),
+    url(r'^banner_show/$', content_manage.views.banner_show),
+    url(r'^banner_add/$', content_manage.views.banner_add),
+    url(r'^banner_edit/$', content_manage.views.banner_edit),
+    url(r'^news_show/$', content_manage.views.news_show),
+    url(r'^news_add/$', content_manage.views.news_add),
+    url(r'^news_look/$', content_manage.views.news_look),
+    url(r'^news_delete/$', content_manage.views.news_delete),
 
 ]

BIN
xdcjing/urls.pyc