如何为django-eav生成表单

时间:2018-08-01 15:33:08

标签: django django-models django-forms entity-attribute-value

我添加了django-eav软件包以在模型上创建自定义字段。通过管理员可以正常工作。

但是,我无法通过模板生成表单。

我收到以下错误消息。

异常值:
未指定ModelForm模型类。

views.py

def add_account(request):
    form = AccountForm()
    return render(request, 'account/add_account.html', {'form': form})

forms.py

from eav.forms import BaseDynamicEntityForm

class AccountForm(BaseDynamicEntityForm):
    model = Account

有关表单和django-eav的文档非常有限。http://mvpdev.github.io/django-eav/docstrings.html#forms希望任何人都可以引导我朝着正确的方向发展。欢呼!

0 个答案:

没有答案