About 269,000 results
Open links in new tab
  1. Django Rest Framework Read Only Model Serializer

    Feb 8, 2019 · This solution uses the private _meta interface of the django model, but it's fairly stable and it's used fairly extensively by developers. Here we're simply generating a list of all the fields in the …

  2. Django rest framework serializing many to many field

    Oct 17, 2015 · How do I serialize a many-to-many field into list of something, and return them through rest framework? In my example below, I try to return the post together with a list of tags associated …

  3. Django rest framework nested self-referential objects

    Nov 14, 2012 · 75 @wjin's solution was working great for me until I upgraded to Django REST framework 3.0.0, which deprecates to_native. Here's my DRF 3.0 solution, which is a slight …

  4. context in nested serializers django rest framework

    Jun 1, 2015 · With newest releases of Django REST Framework, the context is passed from parent to child serializer without need to override __init__ method, all you have to do is pass context when you …

  5. Django REST Framework: adding additional field to ModelSerializer

    I want to serialize a model, but want to include an additional field that requires doing some database lookups on the model instance to be serialized: class FooSerializer(serializers.ModelSerialize...

  6. Write only, read only fields in django rest framework

    Jan 25, 2016 · Core arguments Each serializer field class constructor takes at least these arguments. Some Field classes take additional, field-specific arguments, but the following should always be …

  7. python - Retrieving a Foreign Key value with django-rest-framework ...

    Retrieving a Foreign Key value with django-rest-framework serializers Asked 12 years, 6 months ago Modified 2 years, 8 months ago Viewed 249k times

  8. How do you Serialize the User model in Django Rest Framework

    Jun 12, 2018 · Am trying to familiarize myself with the Django Rest Framework. Tried an experiment to list the users I created but the serializer always returns blank objects.

  9. Django REST Framework - Serializing optional fields

    Update for REST framework 3.0 serializer.fields can be modified on an instantiated serializer. When dynamic serializer classes are required I'd probably suggest altering the fields in a custom …

  10. Django Rest-Framework nested serializer order - Stack Overflow

    Jan 14, 2018 · Is there a way to order a nested serializer _set, for example order by pk or time-stamp. So basically order song_set shown in the json data below from the most recent to the latest object …