Let's say I have some classes:
class Resource(models.Model):
files = models.ManyToManyField("File")
class File(models.Model):
name = models.CharField(max_length=255)
file = models.FileField(upload_to="path/here")
In the Admin View, instead displaying the select multiple box, I want to display something like this:
Name of File [Delete]
So I create a custom widget by subclassing form.SelectMultiple and write custom render and render_options fields. Then I do this in my form definition:
files = forms.ModelMultipleChoiceField(queryset=File.objects.all(), widget=EasyView)
And everything works fine. Except now I don't see the '+' icon next to the widget. The FileAdmin Form is registered with the admin site and it works when I use the standard widget. I believe I want RelatedFieldWidgetWrapper to wrap my field, but I can't figure out how to make it do that.
Thanks.