Add has_a_pending_payment field to Device model and update related views for payment handling
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 2m38s

This commit is contained in:
2025-04-07 22:24:52 +05:00
parent c127c5d093
commit c3abdd8e34
5 changed files with 46 additions and 23 deletions

View File

@ -3,19 +3,25 @@ from django.utils import timezone
from api.models import User
class Device(models.Model):
name = models.CharField(max_length=255)
mac = models.CharField(max_length=255)
has_a_pending_payment = models.BooleanField(default=False)
reason_for_blocking = models.CharField(max_length=255, null=True, blank=True)
is_active = models.BooleanField(default=False)
registered = models.BooleanField(default=False)
blocked = models.BooleanField(default=False)
blocked_by = models.CharField(max_length=255, choices=[('ADMIN', 'Admin'), ('PARENT', 'Parent')], default='PARENT')
blocked_by = models.CharField(
max_length=255,
choices=[("ADMIN", "Admin"), ("PARENT", "Parent")],
default="PARENT",
)
expiry_date = models.DateTimeField(null=True, blank=True)
created_at = models.DateTimeField(default=timezone.now)
updated_at = models.DateTimeField(auto_now=True)
user = models.ForeignKey(User, on_delete=models.SET_NULL, null=True, blank=True, related_name='devices')
user = models.ForeignKey(
User, on_delete=models.SET_NULL, null=True, blank=True, related_name="devices"
)
def __str__(self):
return self.name
return self.name