remove license models from softwares admin

This commit is contained in:
Andreas Zweili 2020-01-12 12:46:49 +01:00
parent 226dad6b2b
commit faf463e7d9
1 changed files with 28 additions and 12 deletions

View File

@ -3,22 +3,38 @@ from django.contrib import admin
# Register your models here.
from .models import (
ComputerLicense,
UserLicense,
OperatingSystem,
Software,
SoftwareArchitecture,
SoftwareCategory,
)
class UserLicenseAdmin(admin.ModelAdmin):
model = UserLicense
extra = 0
verbose_name_plural = 'User Licenses'
class OperatingSystemAdmin(admin.ModelAdmin):
def get_model_perms(self, request):
"""
Return empty perms dict thus hiding the model from admin index.
"""
return {}
class ComputerLicenseAdmin(admin.ModelAdmin):
model = ComputerLicense
extra = 0
verbose_name_plural = 'Computer Licenses'
class SoftwareArchitectureAdmin(admin.ModelAdmin):
def get_model_perms(self, request):
"""
Return empty perms dict thus hiding the model from admin index.
"""
return {}
admin.site.register(ComputerLicense, ComputerLicenseAdmin)
admin.site.register(UserLicense, UserLicenseAdmin)
class SoftwareCategoryAdmin(admin.ModelAdmin):
def get_model_perms(self, request):
"""
Return empty perms dict thus hiding the model from admin index.
"""
return {}
admin.site.register(OperatingSystem, OperatingSystemAdmin)
admin.site.register(Software)
admin.site.register(SoftwareArchitecture, SoftwareArchitectureAdmin)
admin.site.register(SoftwareCategory, SoftwareCategoryAdmin)