many to many - Django, overriding ManyToManyField -
i sorta building own widget, based on manytomanyrawidwidget.
but try following in modeladmin:
formfield_overrides = { manytomanyfield: {'widget': manytomanyrawidwidget}, }
it'll prompt me
__init__() takes 2 arguments (1 given)
i figured needed fill rel
argument something, relation model (which tag
model)
but run templatesyntaxerror:
caught attributeerror while rendering: type object 'tag' has no attribute 'to'
this lose oversight. me out?
just want make sure heeded warning in documentation formfield_overrides:
warning
if want use custom widget relation field (i.e. foreignkey or manytomanyfield), make sure haven't included field's name in raw_id_fields or radio_fields.
formfield_overrides won't let change widget on relation fields have raw_id_fields or radio_fields set. that's because raw_id_fields , radio_fields imply custom widgets of own.
i'm not aware of manytomanyrawidwidget judging name assume raw_id_fields might set in case? might why isn't working.
Comments
Post a Comment