Questions tagged [drf-extensions]

13 questions
20
votes
4 answers

Django Rest Framework API Client Custom Header

I am trying to use bulk update from drf-extensions. To make it work, there is a safeguard requiring the header "X-BULK-OPERATION": 'true'. I can get the application working using curl or my angular app, but in my tests I am trying to use…
Murphy4
  • 1,499
  • 2
  • 15
  • 22
5
votes
1 answer

Django-rest-framework drf-extensions: Nested routers/urls are not filtering

I can't get the my Router to filter my requests based on the "parents_query_lookup". Here's my code: urls.py: from rest_framework_extensions.routers import ExtendedSimpleRouter from .views import OrganizationViewSet, GroupViewSet,…
4
votes
2 answers

CacheResponseMixin does not work with pagination

I have added CacheResponseMixin from drf-extensions to my viewset, but only the first page is cached and returned for all other pages e.g. /?page=2 simply returns the results for page 1. class ProductViewSet(CacheResponseMixin,…
RunLoop
  • 20,288
  • 21
  • 96
  • 151
2
votes
0 answers

Nested routes using drf-extensions are not documented in API docs

I'm writing API in DRF and had need to add nested routes. Since drf-extensions are specified in official documentation I tend to use this package and it seemed to be working, but the documentation generated by Django Rest Framework doesn't include…
Bob
  • 103
  • 8
2
votes
1 answer

Why isn't the drf-extensions CacheResponseMixin caching?

I'm using Django Rest Framework and the DRF-Extensions for caching. I have a viewset with custom list() and retrieve() methods. I can put @cache_response() decorators on the methods and it successfully gets and sets to the cache. However, if I try…
Soviut
  • 88,194
  • 49
  • 192
  • 260
1
vote
1 answer

Could not resolve URL for hyperlinked relationship using view name "rest:campaign-detail"

A newbie here in the world of Django. I am struggling with creating a hyperlink for a nested route. The error I am getting is: Could not resolve URL for hyperlinked relationship using view name "rest:campaign-detail". You may have failed to include…
1
vote
2 answers

how to do nested routes drf-extensions django using uuid instead of id

I have two Django models - I will change the name of my models here but the idea is the same. class Photo(models.Model): uuid = models.UUIDField(primary_key=True, default=uuid.uuid4) image = models.ImageField(upload_to='photos') created_at =…
Michael Torres
  • 512
  • 3
  • 21
1
vote
1 answer

Django REST Framework Extension recursive nested urls

I want to create URLs for CMS portion of project I have following models class Category(models.Model): name = models.CharField(max_length=150) parent = models.ForeignKey('self', blank=True, null=True) class Page(models.Model): title =…
Ubaid
  • 431
  • 4
  • 14
1
vote
1 answer

DRF-Extension cache ignoring query parameters

I am using drf-extension for caching my APIs. But it is not working as expected with cache_response decorator. It caches the response for say /api/get-cities/?country=india . But when I hit /api/get-cities/?country=usa, I get the same…
Manasvi Batra
  • 384
  • 2
  • 14
0
votes
1 answer

Unable to use mixins from drf-extensions

I have installed drf-extensions and imported it to my views. After that, I started getting below exception and I was not able to identify the root cause of this. Can someone explain me, what went wrong here pls? > python .\manage.py…
0
votes
0 answers

Django Restframework error: getting Attribute error and Value error

I'm getting the following errors while running my Django 1.11 project with djangorestframework and djangorestframework-extensions: Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/django/template/base.py", line 903,…
0
votes
0 answers

How to work with drf-extension (Django Rest Framework) if the model has lookup_fields assigned

It would be better if I give an example that I was working on. The Models are class Author(models.Model): id = models.IntegerField(db_column='a_id', primary_key=True) first_name = models.CharField(max_length=20) last_name =…
sadat
  • 4,004
  • 2
  • 29
  • 49
0
votes
1 answer

Validate pk as int in drf viewset retrieve url

Code looks as follows: class UserViewSet(ViewSet): # ... Many other actions def list(self): # list implementation def retrieve(self, request, pk): # manual pk int validation router =…
maslak
  • 1,115
  • 3
  • 8
  • 22