diff --git a/shop/api/v1/viewsets.py b/shop/api/v1/viewsets.py index aa72d8f..86b7fed 100644 --- a/shop/api/v1/viewsets.py +++ b/shop/api/v1/viewsets.py @@ -45,6 +45,7 @@ class ProductViewSet(ModelViewSet): IsAdminUser, ProductPermissions, ) + search_fields = ('name', ) def get_serializer_class(self): if self.action == "create": diff --git a/shop/models.py b/shop/models.py index 8e42bec..a4c50ab 100644 --- a/shop/models.py +++ b/shop/models.py @@ -53,7 +53,7 @@ class Product(models.Model): class Meta: verbose_name = _("Producto") verbose_name_plural = _("Productos") - ordering = ('id', ) + ordering = ('-id', ) class ProductPrice(models.Model):