minecraft_manager/api/models.py

26 lines
1.2 KiB
Python
Raw Normal View History

2018-11-21 23:04:47 +00:00
from django.db import models
2018-11-22 03:15:21 +00:00
from minecraft_manager.api.api import generate_password
2018-11-21 23:04:47 +00:00
class Token(models.Model):
2018-11-22 03:15:21 +00:00
key = models.CharField("Key", default=generate_password, max_length=50, unique=True)
2018-11-23 15:28:05 +00:00
description = models.CharField("Description", max_length=200, blank=True)
2018-11-21 23:04:47 +00:00
active = models.BooleanField("Active", default=True)
2018-11-22 03:15:21 +00:00
web_get_permission = models.BooleanField("Web GET", default=False)
web_post_permission = models.BooleanField("Web POST", default=False)
plugin_get_permission = models.BooleanField("Plugin GET", default=False)
plugin_post_permission = models.BooleanField("Plugin POST", default=False)
form_get_permission = models.BooleanField("Form GET", default=False)
form_post_permission = models.BooleanField("Form POST", default=False)
model_get_permission = models.BooleanField("Model GET", default=False)
model_post_permission = models.BooleanField("Model POST", default=False)
stats_get_permission = models.BooleanField("Stats GET", default=False)
stats_post_permission = models.BooleanField("Stats POST", default=False)
@property
def display(self):
return self.description if self.description else self.key
2018-11-22 03:15:21 +00:00
def __str__(self):
return self.key