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:
26
netbox/users/migrations/0011_standardize_models.py
Normal file
26
netbox/users/migrations/0011_standardize_models.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('users', '0010_update_jsonfield'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='objectpermission',
|
||||
name='id',
|
||||
field=models.BigAutoField(primary_key=True, serialize=False),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='token',
|
||||
name='id',
|
||||
field=models.BigAutoField(primary_key=True, serialize=False),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='userconfig',
|
||||
name='id',
|
||||
field=models.BigAutoField(primary_key=True, serialize=False),
|
||||
),
|
||||
]
|
@@ -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.
|
||||
|
Reference in New Issue
Block a user