Closed pupattan closed 3 years ago
If you override the appropriate methods, yes. (See https://github.com/wagtail/wagtail-generic-chooser#customising-chooser-views for an example of overriding.) At minimum, you'll want to override the get_object_id
method of DRFChooserMixin
to return the desired field:
https://github.com/wagtail/wagtail-generic-chooser/blob/ee0ce5ecda891ac5963ac7edc83a7b55ccb6be0c/generic_chooser/views.py#L271-L272
However, if you're intending to use that with a chooser widget, you'll probably need to customise a lot more than that, because when it tries to re-display an already populated widget, it'll try to look up the object by ID so that it can display the object's friendly name - and if you've only stored the slug / type and not the ID, that's not really possible.
I am using DRFChooserViewSet, every time i choose an item id is selected and saved . Is there any way to save other parameters like type or slug