Accept image upload on Badge create
This commit is contained in:
Родитель
2c7972b960
Коммит
f66d12bac2
|
@ -43,7 +43,7 @@ class BadgeEditForm(MyModelForm):
|
|||
|
||||
class Meta:
|
||||
model = Badge
|
||||
fields = ('title', 'description',)
|
||||
fields = ('title', 'image', 'description',)
|
||||
|
||||
required_css_class = "required"
|
||||
error_css_class = "error"
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
<dl class="badge" data-slug="{{ badge.slug }}">
|
||||
{% if award and award.image %}
|
||||
<dt>Image:</dt>
|
||||
<dd class="image"><img src="{{ award.image.url }}" width="256" height="256" /></dd>
|
||||
{% elif badge.image %}
|
||||
<dt>Image:</dt>
|
||||
<dd class="image"><img src="{{ badge.image.url }}" width="256" height="256" /></dd>
|
||||
{% endif %}
|
||||
<dt>Title:</dt>
|
||||
<dd class="title">{{ badge.title }}</dd>
|
||||
{% if badge.description %}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<h2>Create a badge</h2>
|
||||
|
||||
<form id="create_badge" method="POST" action="">
|
||||
<form id="create_badge" method="POST" action="" enctype="multipart/form-data">
|
||||
{{ csrf() }}
|
||||
<ul>
|
||||
{{ form.as_ul() }}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<h2>Edit badge: {{ badge.title }}</h2>
|
||||
|
||||
<form id="edit_badge" method="POST" action="">
|
||||
<form id="edit_badge" method="POST" action="" enctype="multipart/form-data">
|
||||
{{ csrf() }}
|
||||
<ul>
|
||||
{{ form.as_ul() }}
|
||||
|
|
Загрузка…
Ссылка в новой задаче