mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Merge branch 'develop' into develop-2.9
This commit is contained in:
@@ -3,6 +3,7 @@ import sys
|
||||
from copy import deepcopy
|
||||
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.core.exceptions import FieldDoesNotExist, ValidationError
|
||||
from django.db import transaction, IntegrityError
|
||||
@@ -13,6 +14,7 @@ from django.shortcuts import get_object_or_404, redirect, render
|
||||
from django.template import loader
|
||||
from django.template.exceptions import TemplateDoesNotExist
|
||||
from django.urls import reverse
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.utils.html import escape
|
||||
from django.utils.http import is_safe_url
|
||||
from django.utils.safestring import mark_safe
|
||||
@@ -164,7 +166,10 @@ class ObjectListView(View):
|
||||
permissions[action] = request.user.has_perm(perm_name)
|
||||
|
||||
# Construct the table based on the user's permissions
|
||||
columns = request.user.config.get(f"tables.{self.table.__name__}.columns")
|
||||
if request.user.is_authenticated:
|
||||
columns = request.user.config.get(f"tables.{self.table.__name__}.columns")
|
||||
else:
|
||||
columns = None
|
||||
table = self.table(self.queryset, columns=columns)
|
||||
if 'pk' in table.base_columns and (permissions['change'] or permissions['delete']):
|
||||
table.columns.show('pk')
|
||||
@@ -188,6 +193,7 @@ class ObjectListView(View):
|
||||
|
||||
return render(request, self.template_name, context)
|
||||
|
||||
@method_decorator(login_required)
|
||||
def post(self, request):
|
||||
|
||||
# Update the user's table configuration
|
||||
|
Reference in New Issue
Block a user