Hi Folks,
I want to increase count value of a record after ftech the record each time
in django rest framework.
*This is my model.py*




*class Dataset(models.Model):    name = models.CharField(max_length = 100)
  number = models.IntegerField()    hits = models.IntegerField(default = 0)*


*api/views.py*










*class DatasetListAPIView(ListAPIView):    serializer_class =
DatasetlSerializer    def get_queryset(self):        qs =
Dataset.objects.all()        word = self.request.query_params.get('word')
      if word is not None:            qs  = qs.filter(name__icontains =
word).order_by(Length('name').asc(),'-hits')                    return qs
  search_fields = ('name',)*

Please help me guys.

Thank You in advance

Regards,
Soumen

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WamWbSOYTACSuzbo3MQORbBEadByphzUT3m7YrO8b2Rjg%40mail.gmail.com.

Reply via email to