Still totally useless but at least it writes to the database
This commit is contained in:
parent
fbf7880e68
commit
bda3405342
@ -64,7 +64,7 @@ class MediagoblinApp(object):
|
|||||||
|
|
||||||
def paste_app_factory(global_config, **kw):
|
def paste_app_factory(global_config, **kw):
|
||||||
connection = pymongo.Connection()
|
connection = pymongo.Connection()
|
||||||
db = kw.get('db_name', 'mediagoblin')
|
db = connection[kw.get('db_name', 'mediagoblin')]
|
||||||
|
|
||||||
return MediagoblinApp(
|
return MediagoblinApp(
|
||||||
db,
|
db,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<body>
|
<body>
|
||||||
<form action="{{ request.urlgen('test_submit') }}" method="POST">
|
<form action="{{ request.urlgen('test_submit') }}" method="POST"
|
||||||
|
enctype="multipart/form-data">
|
||||||
<table>
|
<table>
|
||||||
{% for field in image_form %}
|
{% for field in image_form %}
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import datetime
|
||||||
|
|
||||||
from webob import Response, exc
|
from webob import Response, exc
|
||||||
import wtforms
|
import wtforms
|
||||||
|
|
||||||
@ -17,7 +19,11 @@ def submit_test(request):
|
|||||||
image_form = ImageSubmitForm(request.POST)
|
image_form = ImageSubmitForm(request.POST)
|
||||||
if request.method == 'POST' and image_form.validate():
|
if request.method == 'POST' and image_form.validate():
|
||||||
# create entry and save in database
|
# create entry and save in database
|
||||||
|
work_id = request.app.db.works.insert(
|
||||||
|
{'title': image_form.title.data,
|
||||||
|
'created': datetime.datetime.now(),
|
||||||
|
'description': image_form.description.data})
|
||||||
|
|
||||||
# save file to disk
|
# save file to disk
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user