添加剩余所有功能
This commit is contained in:
@@ -132,3 +132,16 @@ class Comment(models.Model): # 定义评论模型
|
||||
db_table = 'comment_tb'
|
||||
verbose_name = '评论'
|
||||
verbose_name_plural = verbose_name
|
||||
|
||||
class Liuyan(models.Model): # 定义留言板模型
|
||||
# article = models.ForeignKey(to=Article, on_delete=models.DO_NOTHING, verbose_name='评论文章')
|
||||
liuyan_id = models.IntegerField(verbose_name='留言给谁了')
|
||||
liuyan_content = models.TextField(verbose_name='留言内容')
|
||||
user = models.ForeignKey(MindUser, on_delete=models.CASCADE) #留言人id
|
||||
liuyan_time = models.DateTimeField(auto_now_add=True, verbose_name='留言时间')
|
||||
|
||||
class Meta:
|
||||
db_table = 'liuyan_tb'
|
||||
verbose_name = '留言'
|
||||
verbose_name_plural = verbose_name
|
||||
|
||||
|
||||
+8
-2
@@ -24,11 +24,15 @@ urlpatterns = [
|
||||
path('ke_cheng',to_kecheng), # 到课程界面
|
||||
path('2_write',to_write), # 到协同边界页面
|
||||
path('2_pinglun',to_pinglun), # 评论
|
||||
path('2_admin',to_admin), # 跳转到管理员页面
|
||||
|
||||
|
||||
path('2_star', to_star), # 到收藏界面
|
||||
path('2_recycle', to_recycle), # 回收站
|
||||
path(r'jsmind_op', JsMindLogView.as_view()), # 更新快照,get日志操作
|
||||
path('2_information', to_information), # 个人信息
|
||||
path('2_liuyan', to_liuyan), # 留言
|
||||
|
||||
path(r'jsmind_op', JsMindLogView.as_view()), # 更新快照,get日志操作
|
||||
# ---------------------------------------------------
|
||||
path('create', JsMindView.as_view()), # 创建思维导图
|
||||
path('list', JsMindView.as_view()), # 查询思维导图
|
||||
@@ -55,6 +59,8 @@ urlpatterns = [
|
||||
|
||||
path('post_kecheng/', post_kecheng, name='post_kecheng'),
|
||||
path('come_kecheng/',come_kecheng, name='come_kecheng'),
|
||||
path('comment_control/',comment_control,name='comment_control') #提交评论处理的路由
|
||||
path('comment_control/',comment_control,name='comment_control'), #提交评论处理的路由
|
||||
path('admin_fun/',admin_fun,name='admin_fun'),
|
||||
path('liuyan_fun/',liuyan_fun,name='liuyan_fun')
|
||||
|
||||
]
|
||||
|
||||
+37
-2
@@ -1,7 +1,7 @@
|
||||
import json
|
||||
|
||||
from django.shortcuts import render
|
||||
from server.models import Task,StudentandTercher,Comment
|
||||
from server.models import Task,StudentandTercher,Comment,Liuyan
|
||||
from server_auth.models import MindUser
|
||||
|
||||
|
||||
@@ -29,6 +29,14 @@ def to_pinglun(request):
|
||||
print(test_date)
|
||||
return render(request, "html/commont.html", param)
|
||||
|
||||
def to_admin(request):
|
||||
username = request.user
|
||||
# supper = MindUser.objects.filter(username=username).type_t_or_s
|
||||
if username.type_t_or_s == 3:
|
||||
datas = MindUser.objects.filter(type_t_or_s=2)
|
||||
return render(request, "html/admin.html",{"datas":datas})
|
||||
else:
|
||||
return render(request, "html/dashboard.html")
|
||||
def to_share(request):
|
||||
"""
|
||||
分享页面
|
||||
@@ -115,4 +123,31 @@ def teacher_login(request):
|
||||
详情页面
|
||||
"""
|
||||
param = {'id': request.GET.get('id')}
|
||||
return render(request, "html/login.html", param)
|
||||
return render(request, "html/login.html", param)
|
||||
|
||||
def to_information(request):
|
||||
"""
|
||||
个人信息页面
|
||||
"""
|
||||
param = {"page": "recycle"}
|
||||
username = request.user
|
||||
datas = MindUser.objects.filter(username=username)
|
||||
xiaozu = MindUser.objects.get(username=username).select_xiaozu
|
||||
kz = MindUser.objects.get(username=username).select_class
|
||||
xiaozu = json.loads(xiaozu)['xiaozu']
|
||||
kc = json.loads(kz)['class']
|
||||
test = zip(kc, xiaozu)
|
||||
it3 = []
|
||||
for it1, it2 in test:
|
||||
it3.append(str(it1) + "课程" + str(it2) + "小组")
|
||||
|
||||
return render(request, "html/informations.html", {"datas":datas,"it3":it3})
|
||||
|
||||
def to_liuyan(request):
|
||||
"""
|
||||
留言板页面
|
||||
"""
|
||||
# param = {"page": "recycle"}
|
||||
datas = MindUser.objects.all()
|
||||
liuyans = Liuyan.objects.filter(liuyan_id=request.user.id)
|
||||
return render(request, "html/liuyan.html", {"datas":datas,"liuyans":liuyans})
|
||||
|
||||
Reference in New Issue
Block a user