#add message
This commit is contained in:
parent
519eadff57
commit
58ba5bcd8d
|
@ -57,6 +57,8 @@ urlpatterns = [
|
|||
#app下载
|
||||
path('app/download/',views.app_download,name='dashboard-app-download'),
|
||||
# 导入用户数据用的
|
||||
path('import/user', views.import_user)
|
||||
path('import/user', views.import_user),
|
||||
|
||||
path('xxxxx/',views.xxxx)
|
||||
|
||||
]
|
||||
|
|
|
@ -46,7 +46,8 @@ def home(request):
|
|||
|
||||
article_count = TimelinessMonitoring.objects.all().aggregate(nums=Sum('update'))['nums']
|
||||
news_count = News.objects.filter(type='3').count()
|
||||
return render(request, 'dashboard/home.html',{'newmedia_count':newmedia_count,'article_count':article_count,'news_count':news_count})
|
||||
return render(request, 'dashboard/home.html',
|
||||
{'newmedia_count': newmedia_count, 'article_count': article_count, 'news_count': news_count})
|
||||
|
||||
|
||||
def index(request):
|
||||
|
@ -67,7 +68,8 @@ def index(request):
|
|||
data.append(o)
|
||||
return render(request, 'dashboard/index.html',
|
||||
{'weixin_count': weixin_count, 'weibo_count': weibo_count, 'toutiao_count': toutiao_count,
|
||||
'qita_count': qita_count, 'douyin_count': douyin_count, 'organization_count': organization_count,'weixin_data':data})
|
||||
'qita_count': qita_count, 'douyin_count': douyin_count, 'organization_count': organization_count,
|
||||
'weixin_data': data})
|
||||
|
||||
|
||||
def user_login(request):
|
||||
|
@ -1189,3 +1191,51 @@ def app_download(request):
|
|||
response['Content-Type'] = 'application/octet-stream'
|
||||
response['Content-Disposition'] = 'attachment;filename="app.apk"'
|
||||
return response
|
||||
|
||||
|
||||
# 政务新媒体的个数, 对应管理员的账号已经激活的
|
||||
def xxxx(request):
|
||||
# u = Userprofile.objects.filter(status='1')
|
||||
weixin_count = []
|
||||
weibo_count = []
|
||||
toutiao_count = []
|
||||
douyin_count = []
|
||||
qita_count = []
|
||||
# print(u.count())
|
||||
# o = []
|
||||
# weixin = None
|
||||
# for i in u:
|
||||
# o.append(i.organization_id)
|
||||
# for j in o:
|
||||
# if Weixin.objects.filter(organization_id=j).count() > 0:
|
||||
# weixin_count.append(Weixin.objects.filter(organization_id=j))
|
||||
# # # toutiao = Toutiao.objects.filter(organization_id=j)
|
||||
# # weixin_count.append(weixin)
|
||||
# # # toutiao_count.append(toutiao)
|
||||
# #
|
||||
# print(len(weixin_count),len(toutiao_count))
|
||||
# # print(len(o))
|
||||
# # print(len(list(set(o))))
|
||||
|
||||
u = Userprofile.objects.filter(status='1')
|
||||
o_list = []
|
||||
for i in u:
|
||||
o_list.append(i.organization_id)
|
||||
print(list(set(o_list)))
|
||||
print(len(list(set(o_list))))
|
||||
|
||||
for j in list(set(o_list)):
|
||||
if Weixin.objects.filter(organization_id=j).count() > 0:
|
||||
weixin_count.append(Weixin.objects.filter(organization_id=j))
|
||||
if Weibo.objects.filter(organization_id=j).count() > 0:
|
||||
weibo_count.append(Weibo.objects.filter(organization_id=j))
|
||||
if Toutiao.objects.filter(organization_id=j).count() > 0:
|
||||
toutiao_count.append(Toutiao.objects.filter(organization_id=j))
|
||||
if Douyin.objects.filter(organization_id=j).count() > 0:
|
||||
douyin_count.append(Douyin.objects.filter(organization_id=j))
|
||||
if Qita.objects.filter(organization_id=j).count() > 0:
|
||||
qita_count.append(Qita.objects.filter(organization_id=j))
|
||||
|
||||
print(len(weixin_count), len(weibo_count), len(toutiao_count), len(douyin_count), len(qita_count))
|
||||
print(int(len(weixin_count))+ len(weibo_count)+len(toutiao_count)+len(douyin_count)+ len(qita_count))
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ if __name__ == '__main__':
|
|||
# with open('F:/用户激活情况表.csv','w', newline='',encoding='utf-8') as csvfile:
|
||||
# writer = csv.writer(csvfile)
|
||||
# writer.writerow(
|
||||
# ["姓名", "单位", "职位", "是否激活", "市", "县"])
|
||||
# ["姓名","电话", "单位", "职位", "是否激活", "市", "县"])
|
||||
# with psycopg2.connect(G2) as connection:
|
||||
# with connection.cursor() as cursor:
|
||||
# cursor.execute(
|
||||
|
@ -34,23 +34,24 @@ if __name__ == '__main__':
|
|||
# else:
|
||||
# x = '未激活'
|
||||
# writer.writerow(
|
||||
# [c1[1], c2[1], c1[5], x, c2[4], c2[5]])
|
||||
# [c1[1],c[4], c2[1], c1[5], x, c2[4], c2[5]])
|
||||
|
||||
# ------------------------------替换市和县---------------------------------------
|
||||
with open('F:/用户激活情况表1.csv','w', newline='',encoding='utf-8') as csvfile:
|
||||
writer = csv.writer(csvfile)
|
||||
writer.writerow(
|
||||
["姓名", "单位", "职位", "是否激活", "市", "县"])
|
||||
["姓名","电话", "单位", "职位", "是否激活", "市", "县"])
|
||||
with open('F:/用户激活情况表.csv',encoding='utf-8') as csvfile:
|
||||
reader = csv.reader(csvfile)
|
||||
for r in reader:
|
||||
if r[0] != '姓名':
|
||||
name = r[0]
|
||||
o = r[1]
|
||||
post = r[2]
|
||||
status = r[3]
|
||||
shi = r[4]
|
||||
xian = r[5]
|
||||
phone= r[1]
|
||||
o = r[2]
|
||||
post = r[3]
|
||||
status = r[4]
|
||||
shi = r[5]
|
||||
xian = r[6]
|
||||
s = None
|
||||
s1 = None
|
||||
with psycopg2.connect(G2) as connection:
|
||||
|
@ -72,5 +73,5 @@ if __name__ == '__main__':
|
|||
s1 = xian
|
||||
print(s1)
|
||||
writer.writerow(
|
||||
[name, o, post, status, s, s1])
|
||||
[name,phone, o, post, status, s, s1])
|
||||
|
||||
|
|
Loading…
Reference in New Issue