/', methods=['GET', 'POST'])
def edit_entry(entry_id):
try:
entry = Entry.get(id=entry_id)
except Entry.DoesNotExist:
abort(404)
if request.method == 'POST':
form = EntryForm(request.form, obj=entry)
if form.validate():
form.populate_obj(entry)
entry.save()
flash('Your entry has been saved')
else:
form = EntryForm(obj=entry)
return render_template('blog/entry_edit.html', form=form, entry=entry)
```
Example template for above view:
```jinja
{% extends "layout.html" %}
{% block body %}
Edit {{ entry.title }}
{% endblock %}
```
wtf-peewee-3.0.6/setup.py 0000644 0001750 0001750 00000001632 14706166541 015560 0 ustar cjwatson cjwatson from setuptools import setup
setup(
name='wtf-peewee',
version='3.0.6',
url='https://github.com/coleifer/wtf-peewee/',
license='MIT',
author='Charles Leifer',
author_email='coleifer@gmail.com',
description='WTForms integration for peewee models',
packages=['wtfpeewee'],
zip_safe=False,
platforms='any',
install_requires=[
'peewee>=3.0.0', 'wtforms',
],
classifiers=[
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Software Development :: Libraries :: Python Modules'
],
test_suite='runtests.runtests'
)
wtf-peewee-3.0.6/runtests.py 0000755 0001750 0001750 00000000603 14706166541 016307 0 ustar cjwatson cjwatson #!/usr/bin/env python
import sys
import unittest
from wtfpeewee import tests
def runtests(*test_args):
suite = unittest.TestLoader().loadTestsFromModule(tests)
result = unittest.TextTestRunner(verbosity=2).run(suite)
if result.failures:
sys.exit(1)
elif result.errors:
sys.exit(2)
sys.exit(0)
if __name__ == '__main__':
runtests(*sys.argv[1:])
wtf-peewee-3.0.6/LICENSE 0000644 0001750 0001750 00000002042 14706166541 015047 0 ustar cjwatson cjwatson Copyright (c) 2010 Charles Leifer
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
wtf-peewee-3.0.6/MANIFEST.in 0000644 0001750 0001750 00000000122 14706166541 015575 0 ustar cjwatson cjwatson include LICENSE
include README.md
include runtests.py
recursive-include example *