The bar has ForeignKey for Foo, many bars for one Foo. Using forms in Django, the default is to enter a selection list by default .
I need this functionality in the Django Rest Framework, first for the API browser, and then for the HTML Renderer template. I was over nested relationships in documents , and also saw this related question , but that doesn't make sense. At the very least, it makes me think that I should see a drop down, just like the stock Django Forms.
Ultimately, I want us to be able to select an existing Foo when creating / updating Bar . I believe that I can do this with TemplateHTMLRenderer by manually creating a form that changes the form fields to full JSON data, i.e. a new bar that points to an existing Foo, suggesting that I am writing an update and creating methods in Bar. But it sounds to me like I'm missing the βeasy wayβ.
class BarSerializer(serializers.ModelSerializer):
I understand that in order to save the embedded data, my serializer needs to be updated and created. We are implementing it now. But I canβt lower my head, what would I do for DRF to fill the selected input with some representation of the Foo parameters?
I'm missing something obvious, huh? Here come the RTFM (again) downvotes: /
source share