Category "django-rest-framework"

Images disappears from django web app deployed to heroku

I am working on a django project, writing rest APIs with django rest framework to use them in android application, my main idea is develop back end in django an

How to hide the Token model from rest_framework.authtoken in django admin panel

I tried to solve the problem using this two methods from rest_framework.authtoken.models import Token admin.site.unregister(Token) ----- from rest_framework.aut

Ho to create serializer for model having foreign keys to access that foreign keys tables data also?

I want to rewrite the following API in a more efficient way using the serializer. In the following API, the user and group are foreign keys. I want to return al

Getting objects before validating data Django REST

I have to create a new Chat object using this view: class ChatListCreateView(ListCreateAPIView): permission_classes = [IsAuthenticated] serializer_class

How to return custom JSON response in DRF?

I have created API for News model: models.py class News(models.Model): title = models.CharField(max_length=255) created_at = models.DateTimeField(auto_n

How can I add two related nested instance in one request using DRF?

Hi I'm new to Django rest framework I have two models: class Location(models.Model): name = models.CharField(("name"), max_length=50) long = models.Char

Django and Axios Forbidden (CSRF token missing or incorrect.)

I am having issue with my django server when trying to connect it to axios. It should be a simple fix but I am stuck! I am getting this error from my django ser

Django cache real-time data with DRF filtering and sorting

I'm building a web app to manage a fleet of moving vehicles. Each vehicle has a set of fixed data (like their license plate), and another set of data that gets

Django Rest-Framework search-fields wont work inside @action

I'm trying to use the search field offered by DRF inside of an action, but it seems to not work. I had a similar problem paginating inside of the action but fou

django_elasticsearch_dsl -RequestError(400, 'search_phase_execution_exception', 'failed to create query: For input string: )

I am trying to search with Elasticsearch using django_elasticsearch_dsl and 'django_elasticsearch_dsl_drf',, but I get RequestError(400, 'search_phase_execution

Stuck in urls.py while migrating a website from Python 2 to Python 3

urlpatterns = format_suffix_patterns(urlpatterns, allowed=['json', 'html']) While running manage.py makemigrations, got this error and was stuck in this error

Is REST framework token authentication safe?

I am relatively new to REST Framework for django. I was creating a simple app to login the users and I tried using Token Authentication. My concern is the token

I'm trying to return mutliply queryset

I have endpoin called groups I want to return to each user groups that he created and the groups that he member in it my model class Group(models.Model): ti

difference between django and django rest framework

Okay I just finished a YouTube course on Django tutorials and i more or less understand Django to an extent. Now the issue is Django rest framework. Google says

'cryptography' package is required for sha256_password or caching_sha2_password auth methods

Request Method: POST Request URL: http://192.168.0.110/admin/login/?next=/admin/ Django Version: 4.0.1 Exception Type: RuntimeError Exception Value: 'cryptog

drf - trailing / in url throwing error while calling post api

views.py class FurnitureViewSet(mixins.ListModelMixin, mixins.RetrieveModelMixin, GenericViewSet): permission_classes = [AllowAny] serializer_class = Fu

Django rest framework using Template to send an e-mail

I want to send a styled email using HTML tags. The mail is sent successfully but without style and the HTML tags are presented as a text in the email. handles.p

drf - remove miliseconds from serializers.DateTimeField when sending response

I have to write a serializer that returns datetime in the following formats: 2012-01-01T13:00:00+00:00 (utc_with_timezone) 2020-01-01T09:00:00 (must be in local

HTTP PATCH to check if handler is available

Can I use HTTP PATCH on endpoint /users to check if some handler is available?

Group base permission rest api in Django

i am using Django rest framework for my login api. Now i want to login only certain group user through api. I have created group and assigned user to the group.