I can send a verification email upon registering the user so that the account can be activated. But how would one go about resending another verification email on an API? Here, I am making an activation link with a token in it and when the user opens the link it takes the token and verifies the user. But how would
Tag: django-rest-framework
How to generate the users activity report in django?
I am building the system in Django rest framework, in which the admin level user will govern the local users , I need to keep track of lower level users activity, example: s user activity such as adding some post or deleting and so on other lots of activities. Is there any package or any good implementation on how it
How to display questions based on subcategory using Django Rest Framework?
I want to display all questions based on subcategory. This is my code : models.py serializers.py view.py /api/subcategory : /api/questions : From the data above I have 2 subcategories Mathematics and History and have 3 questions based on the subcategory, 2 questions about mathematics and 1 question about history. How to display in /api/questions only 2 questions about Mathematics? I’m
SearchFilter for multiple models — Django
Using Django 3.2 with Restframework. I’m trying for search filter and create a API with restframework which would output the searched term with its whole object. I had a little success on that with official doc. But from that I can only search in a single Model and not as globally. I found a blog on how to use multiple
how to filter images from a list of files in django-rest-framework
I have a Django rest server which server a list of files to react frontend. I would like to know if I can filter those files by images and display only images to my react frontend. I have searched a lot but cannot find anything useful. Please help me. Thank you in advance. Answer I finally got it working using
Object of type BoundField is not JSON serializable
A have a chain of OneToMany relations (one) Construction -> Camera -> Frame -> Event models.py I want to output data about Camera in EventSerializer (GET method). I am using get_construction method I want to use ConstructionSerializer for Construction object ( <class ‘api_buildings.models.Construction’>) But I have an error Object of type BoundField is not JSON serializable How can I fix
Filtering the specific data for response in DRF
I have following response data But I want to remove the dictionary whose id = 10 from the response data ,how can I do that ? I have following lines of code.. In serializers.py Any help would be appreciated !! Answer What happens if you do something as following :
url path is matching the wrong view in drf viewsets
Django beginner here, I have two similar endpoints as shown below, they differ in their url_path of the action decorator and the request parameters requester_id and approval id The problem both /workflow_approvals/{requester_id}/ and /workflow_approvals/{approval_id}/ are routing to the requester method view(the first below) my urls.py file looks like this Answer Django doesn’t have a way of differentiating /workflow_approvals/{requester_id}/ and /workflow_approvals/{approval_id}/,
How to filter by a list in Django REST Framework?
Suppose I have a model called X, X contains a field called Ys, a many-to-many field for a class Y. If I have a list of multiple instances of the model Y, how to filter for Xs that have the field Ys that is a superset of my list? Example: I have 3 X objects here: x1.Ys = [y1, y3,
TypeError at /api/questions/ ‘list’ object is not callable
When I go to this http://127.0.0.1:8000/api/questions/ I get TypeError at /api/questions/ ‘list’ object is not callable urls.py (in project) urls.py (in appName1/api views.py (in appName1/api) Only showing QuestionViewSet From the settings.py Error could come from somewhere else. I don’t know where I can find “list”. appName1 = questions Exception Location: lib/python3.9/site-packages/rest_framework/generics.py, line 162, in paginator Answer The DEFAULT_PAGINATION_CLASS setting should