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