I have an admin class which uses raw_id_fields. Instead of displaying the number key, I would like to convert that to the __unicode__
for the corresponding foreign key object.
I thought a way to do this would be to add a form to the admin class. This form would be one in which the field I want to change is overridden with my own widget.
As an intermediate step, I just want to duplicate the existing behavior - so the raw id field would be displayed with its adjacent icon. I have a form with a widget of ForeignKeyRawIdWidget. This widget needs an argument though and I don't know what to give it. I have tried ForeignKeyRawIdWidget(DBObjectName.objects.get(pk=53)), for example, but I get the error DBObjectName object has no attribute 'to'.
I can see from its definition in related.py that the widget needs a to argument, but I don't know what it is looking for.