mirror of
https://github.com/i701/sarlink-portal-api.git
synced 2025-06-28 05:26:07 +00:00
Initial commit
This commit is contained in:
21
devices/models.py
Normal file
21
devices/models.py
Normal file
@ -0,0 +1,21 @@
|
||||
from django.db import models
|
||||
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)
|
||||
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')
|
||||
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')
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
Reference in New Issue
Block a user