forked from AFPy/afpy.org
Add files in save function
This commit is contained in:
parent
a2e5df1889
commit
70e08e1a0a
6
afpy.py
6
afpy.py
|
@ -151,7 +151,8 @@ def save_post(name, token=None):
|
|||
timestamp = None
|
||||
try:
|
||||
post = data.save_post(
|
||||
name, timestamp=timestamp, admin=False, form=request.form
|
||||
name, timestamp=timestamp, admin=False,
|
||||
form=request.form, files=request.files
|
||||
)
|
||||
except data.DataException as e:
|
||||
abort(e.http_code)
|
||||
|
@ -170,7 +171,8 @@ def save_post_admin(name, timestamp):
|
|||
abort(404)
|
||||
try:
|
||||
data.save_post(
|
||||
name, timestamp=timestamp, admin=True, form=request.form
|
||||
name, timestamp=timestamp, admin=True,
|
||||
form=request.form, files=request.files
|
||||
)
|
||||
except data.DataException as e:
|
||||
abort(e.http_code)
|
||||
|
|
|
@ -89,7 +89,7 @@ def get_post(category, timestamp, states=None):
|
|||
return post
|
||||
|
||||
|
||||
def save_post(category, timestamp, admin, form):
|
||||
def save_post(category, timestamp, admin, form, files):
|
||||
if timestamp is None:
|
||||
status = STATE_WAITING
|
||||
timestamp = str(int(time.time()))
|
||||
|
|
|
@ -30,6 +30,9 @@
|
|||
<label>Description
|
||||
<textarea name="summary">{{ post.summary }}</textarea>
|
||||
</label>
|
||||
<label>
|
||||
<input name="image" id="image" type="file" value="{{ post.image }}" />
|
||||
</label>
|
||||
<label>Contenu de l'article
|
||||
<textarea name="content" id="content">{{ post.content }}</textarea>
|
||||
</label>
|
||||
|
|
Loading…
Reference in New Issue
Block a user