mirror of
https://github.com/eduardogsilva/wireguard_webadmin.git
synced 2026-02-20 03:36:16 +00:00
Add api_v2 app with ApiKey model and initial migration
This commit is contained in:
21
api_v2/models.py
Normal file
21
api_v2/models.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import uuid
|
||||
|
||||
from django.db import models
|
||||
|
||||
from wireguard.models import WireGuardInstance
|
||||
|
||||
|
||||
class ApiKey(models.Model):
|
||||
name = models.CharField(max_length=64, unique=True)
|
||||
token = models.UUIDField(default=uuid.uuid4, unique=True)
|
||||
allowed_instances = models.ManyToManyField(WireGuardInstance, blank=True, related_name='api_keys')
|
||||
allow_restart = models.BooleanField(default=True)
|
||||
allow_reload = models.BooleanField(default=True)
|
||||
allow_export = models.BooleanField(default=True)
|
||||
enabled = models.BooleanField(default=True)
|
||||
|
||||
uuid = models.UUIDField(default=uuid.uuid4, editable=False, unique=True)
|
||||
created = models.DateTimeField(auto_now_add=True)
|
||||
updated = models.DateTimeField(auto_now=True)
|
||||
def __str__(self):
|
||||
return self.name
|
||||
Reference in New Issue
Block a user