Unverified Commit 6505d6b2 authored by Jason Grider's avatar Jason Grider Committed by GitHub

Update form.py

Fixing so that it will work with Peewee 3.0's changed Model class and ForeignKeyField pieces.
parent b78fbc50
from wtforms import fields from wtforms import fields
from peewee import (CharField, DateTimeField, DateField, TimeField, from peewee import (CharField, DateTimeField, DateField, TimeField,
PrimaryKeyField, ForeignKeyField, BaseModel) PrimaryKeyField, ForeignKeyField)
try:
from peewee import BaseModel
except ImportError:
from peewee import ModelBase as BaseModel
from wtfpeewee.orm import ModelConverter, model_form from wtfpeewee.orm import ModelConverter, model_form
...@@ -265,7 +270,10 @@ class InlineModelConverter(InlineModelConverterBase): ...@@ -265,7 +270,10 @@ class InlineModelConverter(InlineModelConverterBase):
allow_pk=True, allow_pk=True,
converter=converter) converter=converter)
prop_name = reverse_field.related_name try:
prop_name = reverse_field.related_name
except AttributeError:
prop_name = reverse_field.backref
label = self.get_label(info, prop_name) label = self.get_label(info, prop_name)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment