From 2bf9bf052f899c7cf7427accb37ad654f5f61685 Mon Sep 17 00:00:00 2001 From: Bob <1397910458@qq.com> Date: Thu, 24 Sep 2020 14:37:12 +0800 Subject: [PATCH] #qq --- NewMediaMonitoring/urls.py | 2 +- dashboard/models.py | 22 +++++++------------ .../management/news-management-create.html | 2 +- management/views.py | 8 +++++++ 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/NewMediaMonitoring/urls.py b/NewMediaMonitoring/urls.py index e71499b..46f8857 100644 --- a/NewMediaMonitoring/urls.py +++ b/NewMediaMonitoring/urls.py @@ -14,7 +14,7 @@ Including another URLconf 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin -from django.urls import path, re_path, include +from django.urls import path, include from django.conf import settings from django.conf.urls.static import static # from wagtail.admin import urls as wagtailadmin_urls diff --git a/dashboard/models.py b/dashboard/models.py index e489b0a..ffebcf4 100644 --- a/dashboard/models.py +++ b/dashboard/models.py @@ -26,18 +26,14 @@ class Group_type(models.Model): class Group(models.Model): - GROUP_STATUS_CHOICES = ( - ('0', '关闭'), - ('1', '开启') - ) id = models.UUIDField('id', primary_key=True, default=uuid.uuid4) name = models.CharField('矩阵名称', max_length=256, null=True, blank=True) presentation = models.TextField('矩阵描述', null=True, blank=True) image = models.FileField(upload_to='groupimage', null=True, blank=True) type = models.ForeignKey( Group_type, on_delete=models.CASCADE, null=True, blank=True) - status = models.CharField( - '状态', max_length=256, null=True, blank=True, choices=GROUP_STATUS_CHOICES) + status = models.IntegerField( + '状态', null=True, blank=True,default=0) province = models.CharField('省', max_length=256, null=True, blank=True) cities = models.CharField('市', max_length=256, null=True, blank=True) district = models.CharField('县', max_length=256, null=True, blank=True) @@ -109,7 +105,7 @@ class Organization(models.Model): village = models.CharField('村', max_length=256, null=True, blank=True) level = models.ForeignKey( Level, on_delete=models.CASCADE, null=True, blank=True) - directly = models.CharField('直属', max_length=256, null=True, blank=True) + directly = models.CharField('单位类型', max_length=256, null=True, blank=True) created = models.DateTimeField('创建时间', auto_now_add=True) updated = models.DateTimeField('更新时间', auto_now=True) @@ -149,10 +145,6 @@ def create_user_profile(sender, instance, created, **kwargs): class NewMedia(models.Model): - NEWMEDIA_STATUS_CHOICES = ( - ('1', '开启'), - ('0', '关闭') - ) id = models.UUIDField('id', primary_key=True, default=uuid.uuid4) code = models.CharField('微信公众号', max_length=256, null=True, blank=True) alias = models.CharField('别名', max_length=256, null=True, blank=True) @@ -160,8 +152,8 @@ class NewMedia(models.Model): upload_to='cover/%Y/%m/%d/', null=True, blank=True) organization = models.ForeignKey( Organization, on_delete=models.CASCADE, null=True, blank=True) - status = models.CharField( - '状态', max_length=256, null=True, blank=True, choices=NEWMEDIA_STATUS_CHOICES) + status = models.IntegerField( + '状态',null=True, blank=True,default=0) attention = models.CharField('关注量', null=True, blank=True, max_length=256) remark = models.CharField('备注', null=True, blank=True, max_length=2560) created = models.DateTimeField('创建时间', auto_now_add=True) @@ -554,7 +546,9 @@ class News(models.Model): ('1', '基层动态'), ('2', '外省动态'), ('3', '监测通报'), - ('4', '舆情热点') + ('4', '舆情热点'), + ('5', '通知'), + ('6', '重点新闻'), ) id = models.UUIDField('id', primary_key=True, default=uuid.uuid4) type = models.CharField('文章类型', max_length=256, null=True, diff --git a/management/templates/management/news-management-create.html b/management/templates/management/news-management-create.html index 912d5e6..440fc1d 100644 --- a/management/templates/management/news-management-create.html +++ b/management/templates/management/news-management-create.html @@ -62,7 +62,7 @@
-
diff --git a/management/views.py b/management/views.py index b20934c..88dcab0 100644 --- a/management/views.py +++ b/management/views.py @@ -1197,6 +1197,10 @@ def new_management(request): o['type'] = '监测通报' elif n.type == '4': o['type'] = '舆情热点' + elif n.type == '5': + o['type'] = '通知' + elif n.type == '6': + o['type'] = '重点新闻' news_list.append(o) return render(request,'management/news-management.html',{'news':news_list}) def news_management_create(request): @@ -1218,6 +1222,10 @@ def news_management_create(request): t = '3' elif type == '舆情热点': t = '4' + elif type == '通知': + t = '5' + elif type == '重点新闻': + t = '6' print(str(title), str(content)) news = News(type=t, title=title, author=author, date=date, content=content,source=source)