def formfield(self, **kwargs): # Use our own widget and give him access to the model class kwargs['widget'] = jQueryTagFieldWidget(self.model) return super(jQueryTagModelField, self).formfield(**kwargs)
def __init__(self, tag_model, *args, **kwargs): self.tag_model = tag_model kwargs["widget"] = jQueryTagFieldWidget(tag_model) super(jQueryTagFormField, self).__init__(*args, **kwargs)