This commit is contained in:
parent
1d4417d438
commit
8a54c0ea48
|
@ -16,8 +16,8 @@
|
|||
|
||||
{% block content %}
|
||||
<div class="page-sidebar ">
|
||||
{% include 'dashboard/base/left.html' %}
|
||||
</div>
|
||||
{% include 'dashboard/base/left.html' %}
|
||||
</div>
|
||||
<div class="container">
|
||||
|
||||
{% if messages %}
|
||||
|
@ -38,7 +38,7 @@
|
|||
</div>
|
||||
|
||||
|
||||
<form action="{% url 'news-management-create' %}" method="post">{% csrf_token %}
|
||||
<form action="{% url 'news-management-create' %}" method="post" enctype="multipart/form-data">{% csrf_token %}
|
||||
<div class="panel-body col-md-12">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="title">新闻标题</label>
|
||||
|
@ -65,12 +65,21 @@
|
|||
<input type="date" class="form-control" id="source"
|
||||
name="date">
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="source">来源</label>
|
||||
<input type="text" class="form-control" id="source"
|
||||
name="source">
|
||||
</div>
|
||||
<div class="form-group col-md-12" >
|
||||
<label class="form-label" for="image">图片
|
||||
<div class="controls">
|
||||
<input type="file" name="image">
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<label for="country">正文</label>
|
||||
|
||||
|
|
|
@ -1211,6 +1211,8 @@ def news_management_create(request):
|
|||
date = request.POST.get('date')
|
||||
content = request.POST.get('content')
|
||||
source = request.POST.get('source')
|
||||
image = request.FILES.get('image')
|
||||
print(str(image) + "5555555555555555555555555")
|
||||
t = None
|
||||
if type == '政策依据':
|
||||
t = '0'
|
||||
|
@ -1228,7 +1230,7 @@ def news_management_create(request):
|
|||
t = '6'
|
||||
|
||||
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,image=image)
|
||||
news.save()
|
||||
messages.success(request, '添加成功!!!')
|
||||
return HttpResponseRedirect('/management/news/management/create/')
|
||||
|
|
Loading…
Reference in New Issue