T
Size: a a a
T
AG
rows = ModelName.objects.filter(fk_id__in=fk_ids)
for row in rows.iterator():
...операции с row...
rows_ids = ModelName.objects.filter(fk_id__in=fk_ids).values_list('id, flat=True)
for row_id in rows_ids:
row = ModelName.objects.get(id=row_id)
...операции с row...
SM
NC
NC
AG
A
SM
NC
NS
class WishlistsViewSet(viewsets.ModelViewSet):
queryset = Wishlist.objects.all()
serializer_class = WishlistModelSerializer
permission_classes = [IsAuthenticated]
def filter_queryset(self, queryset):
queryset = super().filter_queryset(queryset)
queryset = queryset.filter(utilizator_id=self.request.user.id)
return queryset
def list(self, request, *args, **kwargs):
return Response(self.serializer_class(self.queryset, many=True).data)
NC
class WishlistsViewSet(viewsets.ModelViewSet):
queryset = Wishlist.objects.all()
serializer_class = WishlistModelSerializer
permission_classes = [IsAuthenticated]
def filter_queryset(self, queryset):
queryset = super().filter_queryset(queryset)
queryset = queryset.filter(utilizator_id=self.request.user.id)
return queryset
def list(self, request, *args, **kwargs):
return Response(self.serializer_class(self.queryset, many=True).data)
NS
NS
NC
NC
NS
NC
NS
GET /wishlist/100/
HTTP 404 Not Found
Allow: GET, PUT, PATCH, DELETE, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept
{
"detail": "Not found."
}
NC
GET /wishlist/100/
HTTP 404 Not Found
Allow: GET, PUT, PATCH, DELETE, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept
{
"detail": "Not found."
}
NS