This commit is contained in:
Bob 2020-09-24 14:37:12 +08:00
parent cfc32c37ee
commit 2bf9bf052f
4 changed files with 18 additions and 16 deletions

View File

@ -14,7 +14,7 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
""" """
from django.contrib import admin 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 import settings
from django.conf.urls.static import static from django.conf.urls.static import static
# from wagtail.admin import urls as wagtailadmin_urls # from wagtail.admin import urls as wagtailadmin_urls

View File

@ -26,18 +26,14 @@ class Group_type(models.Model):
class Group(models.Model): class Group(models.Model):
GROUP_STATUS_CHOICES = (
('0', '关闭'),
('1', '开启')
)
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4) id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
name = models.CharField('矩阵名称', max_length=256, null=True, blank=True) name = models.CharField('矩阵名称', max_length=256, null=True, blank=True)
presentation = models.TextField('矩阵描述', null=True, blank=True) presentation = models.TextField('矩阵描述', null=True, blank=True)
image = models.FileField(upload_to='groupimage', null=True, blank=True) image = models.FileField(upload_to='groupimage', null=True, blank=True)
type = models.ForeignKey( type = models.ForeignKey(
Group_type, on_delete=models.CASCADE, null=True, blank=True) Group_type, on_delete=models.CASCADE, null=True, blank=True)
status = models.CharField( status = models.IntegerField(
'状态', max_length=256, null=True, blank=True, choices=GROUP_STATUS_CHOICES) '状态', null=True, blank=True,default=0)
province = models.CharField('', max_length=256, null=True, blank=True) province = models.CharField('', max_length=256, null=True, blank=True)
cities = 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) 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) village = models.CharField('', max_length=256, null=True, blank=True)
level = models.ForeignKey( level = models.ForeignKey(
Level, on_delete=models.CASCADE, null=True, blank=True) 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) created = models.DateTimeField('创建时间', auto_now_add=True)
updated = models.DateTimeField('更新时间', auto_now=True) updated = models.DateTimeField('更新时间', auto_now=True)
@ -149,10 +145,6 @@ def create_user_profile(sender, instance, created, **kwargs):
class NewMedia(models.Model): class NewMedia(models.Model):
NEWMEDIA_STATUS_CHOICES = (
('1', '开启'),
('0', '关闭')
)
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4) id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
code = models.CharField('微信公众号', max_length=256, null=True, blank=True) code = models.CharField('微信公众号', max_length=256, null=True, blank=True)
alias = 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) upload_to='cover/%Y/%m/%d/', null=True, blank=True)
organization = models.ForeignKey( organization = models.ForeignKey(
Organization, on_delete=models.CASCADE, null=True, blank=True) Organization, on_delete=models.CASCADE, null=True, blank=True)
status = models.CharField( status = models.IntegerField(
'状态', max_length=256, null=True, blank=True, choices=NEWMEDIA_STATUS_CHOICES) '状态',null=True, blank=True,default=0)
attention = models.CharField('关注量', null=True, blank=True, max_length=256) attention = models.CharField('关注量', null=True, blank=True, max_length=256)
remark = models.CharField('备注', null=True, blank=True, max_length=2560) remark = models.CharField('备注', null=True, blank=True, max_length=2560)
created = models.DateTimeField('创建时间', auto_now_add=True) created = models.DateTimeField('创建时间', auto_now_add=True)
@ -554,7 +546,9 @@ class News(models.Model):
('1', '基层动态'), ('1', '基层动态'),
('2', '外省动态'), ('2', '外省动态'),
('3', '监测通报'), ('3', '监测通报'),
('4', '舆情热点') ('4', '舆情热点'),
('5', '通知'),
('6', '重点新闻'),
) )
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4) id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
type = models.CharField('文章类型', max_length=256, null=True, type = models.CharField('文章类型', max_length=256, null=True,

View File

@ -62,7 +62,7 @@
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="date">时间</label> <label for="date">时间</label>
<input type="text" class="form-control" id="source" <input type="date" class="form-control" id="source"
name="date"> name="date">
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">

View File

@ -1197,6 +1197,10 @@ def new_management(request):
o['type'] = '监测通报' o['type'] = '监测通报'
elif n.type == '4': elif n.type == '4':
o['type'] = '舆情热点' o['type'] = '舆情热点'
elif n.type == '5':
o['type'] = '通知'
elif n.type == '6':
o['type'] = '重点新闻'
news_list.append(o) news_list.append(o)
return render(request,'management/news-management.html',{'news':news_list}) return render(request,'management/news-management.html',{'news':news_list})
def news_management_create(request): def news_management_create(request):
@ -1218,6 +1222,10 @@ def news_management_create(request):
t = '3' t = '3'
elif type == '舆情热点': elif type == '舆情热点':
t = '4' t = '4'
elif type == '通知':
t = '5'
elif type == '重点新闻':
t = '6'
print(str(title), str(content)) print(str(title), str(content))
news = News(type=t, title=title, author=author, date=date, content=content,source=source) news = News(type=t, title=title, author=author, date=date, content=content,source=source)