19👍
✅
def get_queryset(self):
...
return Article.objects.filter(created_at__startswith=publication_date, slug=self.kwargs.get("pk", None))
Because get_queryset
must return QuerySet object, not model one
0👍
you can also use get_object()
def get_object(self):
...
return Article.objects.get(created_at__startswith=publication_date, slug=self.kwargs.get("pk", None))
- Supervisor – Can't start supervisorctl as root or user (User is set in config)
- Update model instance with dynamic field names
- Hide password field in GET but not POST in Django REST Framework where depth=1 in serializer
Source:stackexchange.com