Answer the question
In order to leave comments, you need to log in
How to submit form generated by wtforms based on mongoengine model?
Hello, there is a function that builds a form based on the mongoengine model
from flask_wtf import Form
from flask.ext.mongoengine.wtf import model_form
from models.modelfile import DataUser
def add_newuser_form():
return model_form(DataUser)
def get(self):
form = add_newuser_form()
return render_template('admin/admin.html', form =form)
{% block contentplace %}
{{ form.login }}
{% endblock %}
File "D:admin_controller.py", line 13, in get
form = add_newuser_form()
File "D:\add_new_user.py", line 9, in add_newuser_form
add_form = model_form(DataUser)
File "C:\Python34\lib\site-packages\flask_mongoengine\wtf\orm.py", line 268, in model_form
field_dict = model_fields(model, only, exclude, field_args, converter)
File "C:\Python34\lib\site-packages\flask_mongoengine\wtf\orm.py", line 225, in model_fields
names = ((k, v.creation_counter) for k, v in model._fields.iteritems())
AttributeError: 'dict' object has no attribute 'iteritems'
Answer the question
In order to leave comments, you need to log in
Because in third python dict doesn't have iteritems method .
python3porting.com/preparing.html#index-5
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question