开发者

How i can get the class of a model in a widget through ModelForms in Admin?

开发者 https://www.devze.com 2022-12-14 00:13 出处:网络
i need make a special widget for ForeignKeys in Admin, but i need get the class of model in the widget, somebody know how i can do it?开发者_C百科

i need make a special widget for ForeignKeys in Admin, but i need get the class of model in the widget, somebody know how i can do it?开发者_C百科

I think the Widget have a Field, and Field have a ModelForm, and obviously ModelForm have a Model, but i need this model in a widget in the admin.


Perhaps looking at the ModelChoiceField form widget would help? http://code.djangoproject.com/browser/django/trunk/django/forms/models.py#L921

0

精彩评论

暂无评论...
验证码 换一张
取 消