This has been bugging me for a while now. My ultimate goal is to show query parameter options inside SwaggerUI and give a form input for each query parameter. Similar to how it is displayed when providing a serializer for POST. I am using a viewset which inherits from GenericViewSet and I have tried the following: provide filter_fields attribute provide
Tag: django-rest-framework
Get current user in Model Serializer
Is it possible to get the current user in a model serializer? I’d like to do so without having to branch away from generics, as it’s an otherwise simple task that must be done. My model: My serializer: And my view: How can I get the model returned, with an additional field user such that my response looks like this:
OperationalError, no such column. Django
I am going through the Django REST framework tutorial found at http://www.django-rest-framework.org/ I am almost finished with it and just added authentication. Now I am getting : I have looked in several places on the web, not just StackOverflow for the solution, it seems like in general that the problem is with my database and need to delete it then
How to use Query Strings for filtering Querysets in Django?
I created my “API” using REST framework, now I am trying to do filtering for it. This is how my models.py looks like: I would like to see “all passengers in particular workspace” or “all passengers in particular airline” etc in my JSON file. Here is my serializers.py: And views.py: I would like to use Filtering against query parameter but
Django Rest Framework File Upload
I am using Django Rest Framework and AngularJs to upload a file. My view file looks like this: As the last line of post method should return all the data, I have several questions: how to check if there is anything in request.FILES? how to serialize file field? how should I use parser? Answer Use the FileUploadParser, it’s all in
Django REST Framework serializer field required=false
from the documentation: read_only Set this to True to ensure that the field is used when serializing a representation, but is not used when updating an instance during deserialization. Defaults to False required Normally an error will be raised if a field is not supplied during deserialization. Set to false if this field is not required to be present during
Django REST Framework – Separate permissions per methods
I am writing an API using Django REST Framework and I am wondering if can specify permissions per method when using class based views. Reading the documentation I see that is quite easy to do if you are writing function based views, just using the @permission_classes decorator over the function of the views you want to protect with permissions. However,