Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion netbox/users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from core.models import ContentType
from ipam.fields import IPNetworkField
from netbox.config import get_config
from netbox.models.features import CloningMixin
from utilities.querysets import RestrictedQuerySet
from utilities.utils import flatten_dict
from .constants import *
Expand Down Expand Up @@ -234,7 +235,7 @@ def create_userconfig(instance, created, raw=False, **kwargs):
# REST API
#

class Token(models.Model):
class Token(CloningMixin, models.Model):
"""
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.
Expand Down Expand Up @@ -285,6 +286,10 @@ class Token(models.Model):
),
)

clone_fields = (
'user', 'expires', 'write_enabled', 'description', 'allowed_ips',
)

objects = RestrictedQuerySet.as_manager()

class Meta:
Expand Down