adding product block
All checks were successful
Deploy Beta (NATIVE) / deploy (push) Successful in 28s

This commit is contained in:
vickytechkey 2026-08-16 14:55:29 +05:30
parent d30ded3842
commit 1bc9e0af96
11 changed files with 6 additions and 11 deletions

Binary file not shown.

View file

@ -30,8 +30,8 @@ def approve_product(request, pk):
except Product.DoesNotExist:
return Response({"detail": "Product not found"}, status=404)
# Database table does not have status/is_active columns (managed=False).
# We bypass save and log the action successfully.
product.status = 'approved'
product.save()
log_product_action(request.user, 'approve_product', product.id, {"title": product.name})
return Response({"message": f"Product '{product.name}' approved successfully"})
@ -43,8 +43,8 @@ def hold_product(request, pk):
except Product.DoesNotExist:
return Response({"detail": "Product not found"}, status=404)
# Database table does not have status/is_active columns (managed=False).
# We bypass save and log the action successfully.
product.status = 'hold'
product.save()
log_product_action(request.user, 'hold_product', product.id, {"title": product.name})
return Response({"message": f"Product '{product.name}' placed on hold"})

View file

@ -41,13 +41,8 @@ class Product(models.Model):
def name(self):
return self.title
@property
def status(self):
return "approved"
@property
def is_active(self):
return True
status = models.CharField(max_length=50, default='pending')
is_active = models.BooleanField(default=True)
class Wallet(models.Model):
supplier_id = models.IntegerField(unique=True)