1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Standardize model types based on function

This commit is contained in:
Jeremy Stretch
2021-02-24 21:01:16 -05:00
parent 0a6ebdee48
commit bec7ea7072
31 changed files with 1569 additions and 579 deletions

View File

@@ -11,6 +11,7 @@ from django.db.models.signals import post_save
from django.dispatch import receiver
from django.utils import timezone
from netbox.models import BigIDModel
from utilities.querysets import RestrictedQuerySet
from utilities.utils import flatten_dict
@@ -50,7 +51,7 @@ class AdminUser(User):
# User preferences
#
class UserConfig(models.Model):
class UserConfig(BigIDModel):
"""
This model stores arbitrary user-specific preferences in a JSON data structure.
"""
@@ -175,7 +176,7 @@ def create_userconfig(instance, created, **kwargs):
# REST API
#
class Token(models.Model):
class Token(BigIDModel):
"""
An API token used for user authentication. This extends the stock model to allow each user to have multiple tokens.
It also supports setting an expiration time and toggling write ability.
@@ -233,7 +234,7 @@ class Token(models.Model):
# Permissions
#
class ObjectPermission(models.Model):
class ObjectPermission(BigIDModel):
"""
A mapping of view, add, change, and/or delete permission for users and/or groups to an arbitrary set of objects
identified by ORM query parameters.