Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tutorial crashes on user create #17

Closed
marcuskelly opened this issue Feb 19, 2017 · 3 comments
Closed

Tutorial crashes on user create #17

marcuskelly opened this issue Feb 19, 2017 · 3 comments

Comments

@marcuskelly
Copy link

When I click "Create" on the user page, the app crashes. This happens on both localhost and PythonAnywhere.com

Python version
2.7 (I used Python 3.5 on PythonAnywhere, same issue)

Operating system
Ubuntu 16.04.1 LTS

The error message in the browser
UndefinedError: 'flask_admin.contrib.sqla.form.UserForm object' has no attribute 'name'

The error message that is logged on the command line
UndefinedError: 'flask_admin.contrib.sqla.form.UserForm object' has no attribute 'name'

@devalbo
Copy link

devalbo commented Feb 20, 2017

The user model flask-diamond sets up does not have a name field. When the template goes to render the model's data, it throws this error. You can prevent the error by commenting out the line {{ lib.render_field(form, form.name) }} in the views/administration/templates/admin/create_user.html file. Comment out lines using {# and #}.

There is a related error in the administration facet in the create_model method of the UserView class in administration.py when you try to create the actual user.

@marcuskelly
Copy link
Author

Hi devalbo,

Thanks for your reply. I actually did the same fix myself. I just wasn't sure if this was the proper fix.

Just to confirm..
To stop app crashing I commented out line 41 in create_user.html {{ lib.render_field(form, form.name) }}
path planets/planets/views/administration/templates/admin/create_user.html

And line 132 in administration.py name=form.data["name"],
path planets/planets/lib/python3.5/site-packages/flask_diamond/facets/administration.py

@iandennismiller
Copy link
Member

iandennismiller commented Nov 11, 2017

Hi @marcuskelly @devalbo - thanks for reporting this! It's been fixed in develop and will be included in the next revision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants