This commit is contained in:
Andreas Zweili 2020-08-03 13:41:49 +02:00
parent a8e531045c
commit a0191b6dc2
22 changed files with 20 additions and 29 deletions

View File

@ -13,5 +13,5 @@ def backup_view_permission(old_fuction):
else:
return HttpResponseForbidden(
"You're not allowed to access this device."
)
)
return new_function

View File

@ -10,4 +10,4 @@ urlpatterns = [
views.BackupCreateView.as_view(), name='backup_create'),
path('delete/backup/<int:pk>/',
views.BackupDeleteView.as_view(), name='backup_delete'),
]
]

View File

@ -64,5 +64,3 @@ class BackupDeleteView(LoginRequiredMixin, DeleteView):
def get_success_url(self):
return reverse('computer', args=(self.object.computer.pk,))

View File

@ -13,5 +13,5 @@ def computer_view_permission(old_fuction):
else:
return HttpResponseForbidden(
"You're not allowed to access this device."
)
)
return new_function

View File

@ -94,4 +94,3 @@ class ComputerGpuRelation(models.Model):
class Meta:
verbose_name_plural = "GPUs in Computer"

View File

@ -94,5 +94,3 @@ def test_computer_detail_view_gpu_relation(create_admin_user):
response = client.get('/computer/' + str(computer.id) + '/')
assert (response.status_code == 200
and helper.in_content(response, gpu))

View File

@ -54,4 +54,4 @@ urlpatterns = [
name='raid_create'),
path('delete/raid/<int:pk>/', views.RaidDeleteView.as_view(),
name='raid_delete'),
]
]

View File

@ -301,5 +301,3 @@ class RaidDeleteView(LoginRequiredMixin, DeleteView):
def get_success_url(self):
return reverse('computer', args=(self.object.computer.pk,))

View File

@ -4,4 +4,4 @@ from django.urls import path, include
urlpatterns = [
# required for the login functionality
path('accounts/', include('django.contrib.auth.urls')),
]
]

View File

@ -12,5 +12,5 @@ def customer_view_permission(old_function):
else:
return HttpResponseForbidden(
"You're not allowed to access this page."
)
)
return new_function

View File

@ -9,4 +9,4 @@ urlpatterns = [
path('create/customer/',
views.CustomerCreateView.as_view(),
name='customer_create'),
]
]

View File

@ -13,5 +13,5 @@ def device_view_permission(old_function):
else:
return HttpResponseForbidden(
"You're not allowed to access this device."
)
)
return new_function

View File

@ -11,4 +11,4 @@ urlpatterns = [
path('delete/license-with-computer/<int:pk>/',
views.LicenseWithComputerDeleteView.as_view(),
name='license_with_computer_delete'),
]
]

View File

@ -59,5 +59,3 @@ class LicenseWithComputerDeleteView(LoginRequiredMixin, DeleteView):
def get_success_url(self):
return reverse('computer', args=(self.object.computer.pk,))

View File

@ -3,7 +3,8 @@ import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "network_inventory.settings")
os.environ.setdefault("DJANGO_SETTINGS_MODULE",
"network_inventory.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:

View File

@ -13,5 +13,5 @@ def net_view_permission(old_fuction):
else:
return HttpResponseForbidden(
"You're not allowed to access this device."
)
)
return new_function

View File

@ -6,4 +6,4 @@ urlpatterns = [
path('customer/<int:pk>/nets/', views.nets_table_view,
name='nets'),
path('net/<int:pk>/', views.net_detail_view, name='net'),
]
]

View File

@ -100,7 +100,7 @@ AUTH_PASSWORD_VALIDATORS = [
]
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend', # this is default
'django.contrib.auth.backends.ModelBackend', # this is default
'guardian.backends.ObjectPermissionBackend',
)

View File

@ -12,8 +12,8 @@ SECRET_KEY = 'development_key'
DEBUG = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}

View File

@ -19,4 +19,3 @@ DATABASES = {
'PORT': 5432,
}
}

View File

@ -13,5 +13,5 @@ def user_view_permission(old_fuction):
else:
return HttpResponseForbidden(
"You're not allowed to access this device."
)
)
return new_function

View File

@ -6,4 +6,4 @@ urlpatterns = [
path('customer/<int:pk>/users/', views.users_table_view,
name='users'),
path('user/<int:pk>/', views.user_detail_view, name='user'),
]
]