question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Inline models do no work anymore

See original GitHub issue

WTForm 2.0 had been released and it does not work.

Tested with freshly installed virtualenv and the sqla-inline example

Traceback (most recent call last):
  File "/Users/lu_zero/venv-2.7/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/Users/lu_zero/venv-2.7/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/Users/lu_zero/venv-2.7/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/lu_zero/venv-2.7/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/lu_zero/venv-2.7/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/lu_zero/venv-2.7/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/lu_zero/venv-2.7/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/lu_zero/venv-2.7/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/lu_zero/venv-2.7/lib/python2.7/site-packages/flask_admin/base.py", line 62, in inner
    return f(self, *args, **kwargs)
  File "/Users/lu_zero/venv-2.7/lib/python2.7/site-packages/flask_admin/base.py", line 62, in inner
    return f(self, *args, **kwargs)
  File "/Users/lu_zero/venv-2.7/lib/python2.7/site-packages/flask_admin/base.py", line 62, in inner
    return f(self, *args, **kwargs)
  File "/Users/lu_zero/venv-2.7/lib/python2.7/site-packages/flask_admin/model/base.py", line 1227, in create_view
    form = self.create_form()
  File "/Users/lu_zero/venv-2.7/lib/python2.7/site-packages/flask_admin/model/base.py", line 799, in create_form
    return self._create_form_class(get_form_data(), obj=obj)
  File "/Users/lu_zero/venv-2.7/lib/python2.7/site-packages/wtforms/form.py", line 212, in __call__
    return type.__call__(cls, *args, **kwargs)
  File "/Users/lu_zero/venv-2.7/lib/python2.7/site-packages/flask_admin/form/__init__.py", line 13, in __init__
    super(BaseForm, self).__init__(formdata=formdata, obj=obj, prefix=prefix, **kwargs)
  File "/Users/lu_zero/venv-2.7/lib/python2.7/site-packages/wtforms/form.py", line 272, in __init__
    super(Form, self).__init__(self._unbound_fields, meta=meta_obj, prefix=prefix)
  File "/Users/lu_zero/venv-2.7/lib/python2.7/site-packages/wtforms/form.py", line 52, in __init__
    field = meta.bind_field(self, unbound_field, options)
  File "/Users/lu_zero/venv-2.7/lib/python2.7/site-packages/wtforms/meta.py", line 27, in bind_field
    return unbound_field.bind(form=form, **options)
  File "/Users/lu_zero/venv-2.7/lib/python2.7/site-packages/wtforms/fields/core.py", line 346, in bind
    return self.field_class(*self.args, **kw)
  File "/Users/lu_zero/venv-2.7/lib/python2.7/site-packages/flask_admin/contrib/sqla/fields.py", line 220, in __init__
    super(InlineModelFormList, self).__init__(form_field, **kwargs)
  File "/Users/lu_zero/venv-2.7/lib/python2.7/site-packages/flask_admin/model/fields.py", line 17, in __init__
    self.template = self.unbound_field.bind(form=None, name='')
  File "/Users/lu_zero/venv-2.7/lib/python2.7/site-packages/wtforms/fields/core.py", line 346, in bind
    return self.field_class(*self.args, **kw)
  File "/Users/lu_zero/venv-2.7/lib/python2.7/site-packages/flask_admin/model/fields.py", line 106, in __init__
    super(InlineModelFormField, self).__init__(form_class, **kwargs)
  File "/Users/lu_zero/venv-2.7/lib/python2.7/site-packages/wtforms/fields/core.py", line 769, in __init__
    super(FormField, self).__init__(label, validators, **kwargs)
  File "/Users/lu_zero/venv-2.7/lib/python2.7/site-packages/wtforms/fields/core.py", line 92, in __init__
    raise TypeError("Must provide one of _form or _meta")
TypeError: Must provide one of _form or _meta

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mrjoescommented, May 21, 2014

Looks like they dropped backwards compatibility.

I will take a look, but for now use 1.x wtforms.

0reactions
tuannh99commented, Jul 1, 2014

Thanks. I forgot to confirm right away that I change the text in file requirements.txt to: “Flask-Admin==1.0.7” and it works properly again. To me, the version 1.0.8 broke.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Django admin ManyToMany inline "has no ForeignKey to" error
When trying to view the admin page to add a Quote , the page shows an error saying <class 'quotes.models.Tag'> has no ForeignKey...
Read more >
What is "Inline Model #"? · Issue #199 - GitHub
It currently has a bug where sometimes child object are not named even when a title property is provided. I have a temporary...
Read more >
Preventing 'Bad Inline Model' Errors - Interlopers.net
The cause of bad inline model errors is the presence of static content (decals) on dynamic brush entities (doors, moving platforms, breakable glass...
Read more >
How to Prevent Your Map from Crashing, or Fix It - TF2Maps.net
The cause of bad inline model errors is the presence of static content (decals) on dynamic brush entities (doors, moving platforms, breakable ...
Read more >
missing "Add" functionality for pages using InlineModelAdmin
Hi, after moving an existing Django app into a Mezzanine 1.0.2 environment, none of my pages showing StackedInline or TabularInline sections ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found