Latest Posts tagged Django

Browse all latest posts tagged Django

Published 17 Apr, 2022
Django - How to return generated file download with Django REST Framework?

I solved my problem by saving file in media folder and sending of the link of it to front-end. @permission_classes((permissions.IsAdminUser,)) class StudentDocxViewSet(mixins.RetrieveModelMixin, view...

Published 31 Mar, 2022
How to upload multiple files in django rest framework

How to upload multiple files in django rest framework

Published 17 Apr, 2022
Django - How to redirect to previous page in Django after POST request

You can add a next field to your form, and set it to request.path. After you processed your form you can redirect to the value of this path. template.html {% csrf_token %} {{ form }}...

Published 31 Mar, 2022
how to unit test file upload in django

how to unit test file upload in django

Published 30 May, 2022
How to use csrf_token in Django RESTful API and React?

The first step is to get CSRF token which can be retrieved from the Django csrftoken cookie. Now fro...

Published 17 Apr, 2022
Django - How to add custom view to django admin interface?

You have 3 options here: Using third-party packages which provide menu This is pretty straight forward, there are some good packages out there which support menu for admin, and some way to add your...

Published 13 Jun, 2022
How to convert blob url into mp3 audio in django

So I found solution for this problem, just include this line of code to convert your blob url to mp3...

Published 17 Apr, 2022
Django - How to unit test permissions in django-rest-framework?

Here is one approach: from django_mock_queries.query import MockSet from mock import patch, MagicMock from unittest import TestCase class TestPermissions(TestCase): memberships = MockSet()...

Published 17 Apr, 2022
Django - Django - How to track if a user is online/offline in realtime?

Using WebSockets is definitely the better approach. Instead of having a binary "online"/"offline" status, you could count connections: When a new WebSocket connects, increase the "online" counter by...

Published 31 Mar, 2022
How to encrypt a password field in django

How to encrypt a password field in django

Published 31 Mar, 2022
How to use enums as a choice field in django model

How to use enums as a choice field in django model

Published 17 Apr, 2022
Django - How to properly setup custom handler404 in django?

As we discussed, your setup is correct, but in settings.py you should make DEBUG=False. It's more of a production feature and won't work in development environment(unless you have DEBUG=False in dev m...

Published 17 Apr, 2022
Django - How to use TailwindCSS with Django?

TL;DR Install TailwindCSS within your Django project, like any JS project with npm Use a live-reload server package with Django Add purgeCSS config before deploying More detailed explanation 1 - The...

Published 17 Apr, 2022
Django - How to get Django and ReactJS to work together?

I don't have experience with Django but the concepts from front-end to back-end and front-end framework to framework are the same. React will consume your Django REST API. Front-ends and back-ends a...

Published 31 Mar, 2022
How to filter objects for count annotation in Django?

How to filter objects for count annotation in Django?