#add message
This commit is contained in:
parent
9ef5c9973a
commit
519eadff57
|
@ -29,11 +29,11 @@ def user_management(request):
|
|||
userpaginator = Userprofile.objects.filter(organization__province=province).order_by('-created')
|
||||
elif level == 2:
|
||||
userpaginator = Userprofile.objects.filter(organization__province=province,
|
||||
organization__cities=cities).order_by('-created')
|
||||
organization__cities=cities).order_by('-created')
|
||||
elif level == 3:
|
||||
userpaginator = Userprofile.objects.filter(organization__province=province,
|
||||
organization__cities=cities,
|
||||
organization__district=district).order_by('-created')
|
||||
organization__cities=cities,
|
||||
organization__district=district).order_by('-created')
|
||||
elif level == 9:
|
||||
userpaginator = Userprofile.objects.all().order_by('-created')
|
||||
userallinfo = []
|
||||
|
@ -96,7 +96,7 @@ def user_management(request):
|
|||
'None', '')
|
||||
userallinfo.append(o)
|
||||
return render(request, 'management/user-management.html',
|
||||
{'userallinfo': userallinfo, 'userpaginator': userpaginator,'user_count':user_count})
|
||||
{'userallinfo': userallinfo, 'userpaginator': userpaginator, 'user_count': user_count})
|
||||
|
||||
|
||||
@login_required
|
||||
|
@ -155,7 +155,6 @@ def user_update(request, pk):
|
|||
|
||||
@login_required
|
||||
def group_management_init(request):
|
||||
|
||||
user = request.user
|
||||
level = Userprofile.objects.get(user_id=user.id).organization.level.level
|
||||
init_count = Group.objects.filter(user_id=user.id).count()
|
||||
|
@ -180,7 +179,8 @@ def group_management_init(request):
|
|||
o1['user_count'] = Group_user.objects.filter(group_id=r_g_i.id).count()
|
||||
o1['status'] = r_g_i.status
|
||||
res_g_i.append(o1)
|
||||
return render(request, 'management/group-management-init.html', {'group': group, 'res_g_i': res_g_i,'init_count':init_count,'level':level})
|
||||
return render(request, 'management/group-management-init.html',
|
||||
{'group': group, 'res_g_i': res_g_i, 'init_count': init_count, 'level': level})
|
||||
|
||||
|
||||
@login_required
|
||||
|
@ -212,7 +212,8 @@ def group_management_admin(request):
|
|||
o2['user_count'] = Group_user.objects.filter(group_id=r_g_a.id).count()
|
||||
o2['status'] = r_g_a.status
|
||||
res_g_a.append(o2)
|
||||
return render(request, 'management/group-management-admin.html', {'group': group, 'res_g_a': res_g_a,'admin_count':admin_count,'level':level})
|
||||
return render(request, 'management/group-management-admin.html',
|
||||
{'group': group, 'res_g_a': res_g_a, 'admin_count': admin_count, 'level': level})
|
||||
|
||||
|
||||
@login_required
|
||||
|
@ -244,10 +245,12 @@ def group_management_user(request):
|
|||
o3['user_count'] = Group_user.objects.filter(group_id=r_g_u.id).count()
|
||||
o3['status'] = r_g_u.status
|
||||
res_g_u.append(o3)
|
||||
return render(request, 'management/group-management-user.html', {'group': group, 'res_g_u': res_g_u,'user_count':user_count,'level':level})
|
||||
return render(request, 'management/group-management-user.html',
|
||||
{'group': group, 'res_g_u': res_g_u, 'user_count': user_count, 'level': level})
|
||||
|
||||
|
||||
@login_required
|
||||
def group_management_superuser(request):
|
||||
|
||||
user = request.user
|
||||
level = Userprofile.objects.get(user_id=user.id).organization.level.level
|
||||
count = Group.objects.all().count()
|
||||
|
@ -271,7 +274,8 @@ def group_management_superuser(request):
|
|||
o1['user_count'] = Group_user.objects.filter(group_id=r_g_i.id).count()
|
||||
o1['status'] = r_g_i.status
|
||||
res_g_i.append(o1)
|
||||
return render(request, 'management/group-management-superuser.html', {'group': group, 'res_g_i': res_g_i,'count':count,'level':level})
|
||||
return render(request, 'management/group-management-superuser.html',
|
||||
{'group': group, 'res_g_i': res_g_i, 'count': count, 'level': level})
|
||||
|
||||
|
||||
@login_required
|
||||
|
@ -282,13 +286,13 @@ def group_update(request, pk):
|
|||
d = ''
|
||||
t = ''
|
||||
v = ''
|
||||
if group.province != '' and group.province != 'None' :
|
||||
if group.province != '' and group.province != 'None':
|
||||
p = Area_code_2020.objects.get(code=group.province).name
|
||||
if group.cities and group.cities != 'None':
|
||||
c = Area_code_2020.objects.get(code=group.cities).name
|
||||
if group.district and group.district != 'None':
|
||||
d = Area_code_2020.objects.get(code=group.district).name
|
||||
if group.town and group.town != 'None' :
|
||||
if group.town and group.town != 'None':
|
||||
t = Area_code_2020.objects.get(code=group.town).name
|
||||
if group.village and group.village != 'None':
|
||||
v = Area_code_2020.objects.get(code=group.village).name
|
||||
|
@ -310,26 +314,32 @@ def group_update(request, pk):
|
|||
o['username'] = g_a.user.username
|
||||
o['name'] = Userprofile.objects.get(user_id=g_a.user.id).name
|
||||
o['organization'] = Userprofile.objects.get(user_id=g_a.user.id).organization.name
|
||||
if g_a.group.province and g_a.group.province != 'None' and g_a.group.cities and g_a.group.cities != 'None' and g_a.group.district and g_a.group.district != 'None' and g_a.group.town and g_a.group.town != 'None' and g_a.group.village and g_a.group.village != 'None':
|
||||
o['administrativedivision'] = str(Area_code_2020.objects.get(code=g_a.group.province).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_a.group.cities).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_a.group.district).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_a.group.town).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_a.group.village).name)
|
||||
elif g_a.group.province and g_a.group.province != 'None' and g_a.group.cities and g_a.group.cities != 'None' and g_a.group.district and g_a.group.district != 'None' and g_a.group.town and g_a.group.town != 'None':
|
||||
o['administrativedivision'] = str(Area_code_2020.objects.get(code=g_a.group.province).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_a.group.cities).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_a.group.district).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_a.group.town).name)
|
||||
elif g_a.group.province and g_a.group.province != 'None' and g_a.group.cities and g_a.group.cities != 'None' and g_a.group.district and g_a.group.district != 'None':
|
||||
o['administrativedivision'] = str(Area_code_2020.objects.get(code=g_a.group.province).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_a.group.cities).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_a.group.district).name)
|
||||
elif g_a.group.province and g_a.group.province != 'None' and g_a.group.cities and g_a.group.cities != 'None':
|
||||
o['administrativedivision'] = str(Area_code_2020.objects.get(code=g_a.group.province).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_a.group.cities).name)
|
||||
elif g_a.group.province and g_a.group.province != 'None':
|
||||
o['administrativedivision'] = str(Area_code_2020.objects.get(code=g_a.group.province).name)
|
||||
|
||||
admin_p = Userprofile.objects.get(user_id=g_a.user_id).organization.province
|
||||
admin_c = Userprofile.objects.get(user_id=g_a.user_id).organization.cities
|
||||
admin_d = Userprofile.objects.get(user_id=g_a.user_id).organization.district
|
||||
admin_t = Userprofile.objects.get(user_id=g_a.user_id).organization.town
|
||||
admin_v = Userprofile.objects.get(user_id=g_a.user_id).organization.village
|
||||
if admin_p and admin_p != 'None' and admin_c and admin_c != 'None' and admin_d and admin_d != 'None' and admin_t and admin_t != 'None' and admin_v and admin_v != 'None':
|
||||
o['administrativedivision'] = str(Area_code_2020.objects.get(code=admin_p).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=admin_c).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=admin_d).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=admin_t).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=admin_v).name)
|
||||
elif admin_p and admin_p != 'None' and admin_c and admin_c != 'None' and admin_d and admin_d != 'None' and admin_t and admin_t != 'None':
|
||||
o['administrativedivision'] = str(Area_code_2020.objects.get(code=admin_p).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=admin_c).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=admin_d).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=admin_t).name)
|
||||
elif admin_p and admin_p != 'None' and admin_c and admin_c != 'None' and admin_d and admin_d != 'None':
|
||||
o['administrativedivision'] = str(Area_code_2020.objects.get(code=admin_p).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=admin_c).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=admin_d).name)
|
||||
elif admin_p and admin_p != 'None' and admin_c and admin_c != 'None':
|
||||
o['administrativedivision'] = str(Area_code_2020.objects.get(code=admin_p).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=admin_c).name)
|
||||
elif admin_p and admin_p != 'None':
|
||||
o['administrativedivision'] = str(Area_code_2020.objects.get(code=str(admin_p)).name)
|
||||
g_a_list.append(o)
|
||||
group_user = Group_user.objects.filter(group_id=pk)
|
||||
g_u_list = []
|
||||
|
@ -340,26 +350,31 @@ def group_update(request, pk):
|
|||
i['username'] = g_u.user.username
|
||||
i['name'] = Userprofile.objects.get(user_id=g_u.user.id).name
|
||||
i['organization'] = Userprofile.objects.get(user_id=g_u.user.id).organization.name
|
||||
if g_u.group.province and g_u.group.province != 'None' and g_u.group.cities and g_u.group.cities != 'None' and g_u.group.district and g_u.group.district != 'None' and g_u.group.town and g_u.group.town != 'None' and g_u.group.village and g_u.group.village != 'None':
|
||||
i['administrativedivision'] = str(Area_code_2020.objects.get(code=g_u.group.province).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_u.group.cities).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_u.group.district).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_u.group.town).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_u.group.village).name)
|
||||
elif g_u.group.province and g_u.group.province != 'None' and g_u.group.cities and g_u.group.cities != 'None' and g_u.group.district and g_u.group.district != 'None' and g_u.group.town and g_u.group.town != 'None':
|
||||
i['administrativedivision'] = str(Area_code_2020.objects.get(code=g_u.group.province).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_u.group.cities).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_u.group.district).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_u.group.town).name)
|
||||
elif g_u.group.province and g_u.group.province != 'None' and g_u.group.cities and g_u.group.cities != 'None' and g_u.group.district and g_u.group.district != 'None':
|
||||
i['administrativedivision'] = str(Area_code_2020.objects.get(code=g_u.group.province).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_u.group.cities).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_u.group.district).name)
|
||||
elif g_u.group.province and g_u.group.province != 'None' and g_u.group.cities and g_u.group.cities != 'None':
|
||||
i['administrativedivision'] = str(Area_code_2020.objects.get(code=g_u.group.province).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=g_u.group.cities).name)
|
||||
elif g_u.group.province and g_u.group.province != 'None':
|
||||
i['administrativedivision'] = str(Area_code_2020.objects.get(code=g_u.group.province).name)
|
||||
user_p = Userprofile.objects.get(user_id=g_u.user_id).organization.province
|
||||
user_c = Userprofile.objects.get(user_id=g_u.user_id).organization.cities
|
||||
user_d = Userprofile.objects.get(user_id=g_u.user_id).organization.district
|
||||
user_t = Userprofile.objects.get(user_id=g_u.user_id).organization.town
|
||||
user_v = Userprofile.objects.get(user_id=g_u.user_id).organization.village
|
||||
if user_p and user_p != 'None' and user_c and user_c != 'None' and user_d and user_d != 'None' and user_t and user_t != 'None' and user_v and user_v != 'None':
|
||||
i['administrativedivision'] = str(Area_code_2020.objects.get(code=user_p).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=user_c).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=user_d).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=user_t).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=user_v).name)
|
||||
elif user_p and user_p != 'None' and user_c and user_c != 'None' and user_d and user_d != 'None' and user_t and user_t != 'None':
|
||||
i['administrativedivision'] = str(Area_code_2020.objects.get(code=user_p).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=user_c).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=user_d).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=user_t).name)
|
||||
elif user_p and user_p != 'None' and user_c and user_c != 'None' and user_d and user_d != 'None':
|
||||
i['administrativedivision'] = str(Area_code_2020.objects.get(code=user_p).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=user_c).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=user_d).name)
|
||||
elif user_p and user_p != 'None' and user_c and user_c != 'None':
|
||||
i['administrativedivision'] = str(Area_code_2020.objects.get(code=user_p).name) + '-' + str(
|
||||
Area_code_2020.objects.get(code=user_c).name)
|
||||
elif user_p and user_p != 'None':
|
||||
i['administrativedivision'] = str(Area_code_2020.objects.get(code=str(user_p)).name)
|
||||
g_u_list.append(i)
|
||||
if request.method == 'POST':
|
||||
name = request.POST.get('name')
|
||||
|
@ -492,6 +507,7 @@ def group_create(request):
|
|||
{'group_status_choices_list': group_status_choices_list, 'group_type': group_type,
|
||||
'g_c_c_res': g_c_c_res})
|
||||
|
||||
|
||||
@login_required
|
||||
def get_user(request):
|
||||
keywords = request.GET.get('keyword')
|
||||
|
@ -530,7 +546,7 @@ def group_admin_create(request, pk):
|
|||
messages.success(request, "添加成功")
|
||||
return HttpResponseRedirect('/management/group/update/%s/' % (pk))
|
||||
group = Group.objects.get(id=pk).name
|
||||
return render(request, 'management/group-admin-create.html', { 'group': group, 'pk': pk})
|
||||
return render(request, 'management/group-admin-create.html', {'group': group, 'pk': pk})
|
||||
|
||||
|
||||
@login_required
|
||||
|
@ -643,7 +659,8 @@ def organization_management(request):
|
|||
organization_id=i.id).count()
|
||||
res.append(o)
|
||||
|
||||
return render(request, 'management/organization-management.html', {"organization": organization, 'res': res,'organization_count':organization_count})
|
||||
return render(request, 'management/organization-management.html',
|
||||
{"organization": organization, 'res': res, 'organization_count': organization_count})
|
||||
|
||||
|
||||
@login_required
|
||||
|
@ -1072,7 +1089,8 @@ def newmedia_management_edit_weixin(request):
|
|||
o['administrativedivision'] = str(Area_code_2020.objects.get(code=w.organization.province).name)
|
||||
o['status'] = w.status
|
||||
res.append(o)
|
||||
return render(request, 'management/newmedia-management-edit-weixin.html', {'weixin': weixin, 'res': res,'weixin_count':weixin_count})
|
||||
return render(request, 'management/newmedia-management-edit-weixin.html',
|
||||
{'weixin': weixin, 'res': res, 'weixin_count': weixin_count})
|
||||
|
||||
|
||||
@login_required
|
||||
|
@ -1142,7 +1160,8 @@ def newmedia_management_edit_weibo(request):
|
|||
o['administrativedivision'] = str(Area_code_2020.objects.get(code=w.organization.province).name)
|
||||
o['status'] = w.status
|
||||
res.append(o)
|
||||
return render(request, 'management/newmedia-management-edit-weibo.html', {'weibo': weibo, 'res': res,'weibo_count':weibo_count})
|
||||
return render(request, 'management/newmedia-management-edit-weibo.html',
|
||||
{'weibo': weibo, 'res': res, 'weibo_count': weibo_count})
|
||||
|
||||
|
||||
@login_required
|
||||
|
@ -1213,7 +1232,8 @@ def newmedia_management_edit_toutiao(request):
|
|||
o['administrativedivision'] = str(Area_code_2020.objects.get(code=w.organization.province).name)
|
||||
o['status'] = w.status
|
||||
res.append(o)
|
||||
return render(request, 'management/newmedia-management-edit-toutiao.html', {'toutiao': toutiao, 'res': res,'toutiao_count':toutiao_count})
|
||||
return render(request, 'management/newmedia-management-edit-toutiao.html',
|
||||
{'toutiao': toutiao, 'res': res, 'toutiao_count': toutiao_count})
|
||||
|
||||
|
||||
@login_required
|
||||
|
@ -1284,7 +1304,8 @@ def newmedia_management_edit_douyin(request):
|
|||
o['administrativedivision'] = str(Area_code_2020.objects.get(code=w.organization.province).name)
|
||||
o['status'] = w.status
|
||||
res.append(o)
|
||||
return render(request, 'management/newmedia-management-edit-douyin.html', {'douyin': douyin, 'res': res,'douyin_count':douyin_count})
|
||||
return render(request, 'management/newmedia-management-edit-douyin.html',
|
||||
{'douyin': douyin, 'res': res, 'douyin_count': douyin_count})
|
||||
|
||||
|
||||
@login_required
|
||||
|
@ -1354,7 +1375,8 @@ def newmedia_management_edit_qita(request):
|
|||
o['administrativedivision'] = str(Area_code_2020.objects.get(code=w.organization.province).name)
|
||||
o['status'] = w.status
|
||||
res.append(o)
|
||||
return render(request, 'management/newmedia-management-edit-qita.html', {'qita': qita, 'res': res,'qita_count':qita_count})
|
||||
return render(request, 'management/newmedia-management-edit-qita.html',
|
||||
{'qita': qita, 'res': res, 'qita_count': qita_count})
|
||||
|
||||
|
||||
@login_required
|
||||
|
@ -1687,7 +1709,8 @@ def new_management(request):
|
|||
elif n.type == '6':
|
||||
o['type'] = '重点新闻'
|
||||
news_list.append(o)
|
||||
return render(request, 'management/news-management.html', {'news': news_list, 'new': news,'news_count':news_count})
|
||||
return render(request, 'management/news-management.html',
|
||||
{'news': news_list, 'new': news, 'news_count': news_count})
|
||||
|
||||
|
||||
@login_required
|
||||
|
@ -1735,8 +1758,10 @@ def news_management_create(request):
|
|||
o['choices'] = list(i)[1]
|
||||
results.append(o)
|
||||
return render(request, 'management/news-management-create.html', {'type': results})
|
||||
|
||||
|
||||
@login_required
|
||||
def news_management_update(request,pk):
|
||||
def news_management_update(request, pk):
|
||||
news = News.objects.get(id=pk)
|
||||
type = News.NEWMEDIA_NEWS_CHOICES
|
||||
results = []
|
||||
|
@ -1772,8 +1797,8 @@ def news_management_update(request,pk):
|
|||
n = News.objects.get(id=pk)
|
||||
if request.POST.get('date'):
|
||||
date = request.POST.get('date')
|
||||
News.objects.filter(id=pk).update(type=t, title=title, author=author, date=date, content=content, source=source)
|
||||
|
||||
News.objects.filter(id=pk).update(type=t, title=title, author=author, date=date, content=content,
|
||||
source=source)
|
||||
|
||||
n.image = image
|
||||
n.save()
|
||||
|
@ -1785,9 +1810,10 @@ def news_management_update(request,pk):
|
|||
else:
|
||||
News.objects.filter(id=pk).update(type=t, title=title, author=author, content=content,
|
||||
source=source)
|
||||
messages.success(request,'编辑成功')
|
||||
messages.success(request, '编辑成功')
|
||||
return HttpResponseRedirect('/management/news/management/')
|
||||
return render(request,'management/news-management-update.html',{'news':news,'type':results})
|
||||
return render(request, 'management/news-management-update.html', {'news': news, 'type': results})
|
||||
|
||||
|
||||
@login_required
|
||||
def news_management_detail(request, pk):
|
||||
|
|
Loading…
Reference in New Issue