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'))
"""
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

View File

@ -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,

View File

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

View File

@ -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)