-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from co-cddo/add-admin-interfaces
Add admin interfaces
- Loading branch information
Showing
13 changed files
with
472 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,47 @@ | ||
# from django.contrib import admin | ||
from django.contrib import admin | ||
from django.contrib.auth.admin import UserAdmin | ||
from django.contrib.auth.admin import GroupAdmin | ||
from django.contrib.auth.models import User | ||
from django.contrib.auth.models import Group | ||
|
||
# Register your models here. | ||
from .models import Application, CentralGovernmentAttributes, Review | ||
|
||
|
||
class DomainRegistrationUserAdmin(UserAdmin): | ||
def has_module_permission(self, request): | ||
if request.user.is_superuser: | ||
return True | ||
return False | ||
|
||
|
||
class DomainRegistrationGroupAdmin(GroupAdmin): | ||
def has_module_permission(self, request): | ||
if request.user.is_superuser: | ||
return True | ||
return False | ||
|
||
|
||
class CentralGovernmentAttributesInline(admin.StackedInline): | ||
model = CentralGovernmentAttributes | ||
can_delete = False | ||
verbose_name_plural = "Central Government Attributes" | ||
|
||
|
||
class ReviewInline(admin.StackedInline): | ||
model = Review | ||
can_delete = False | ||
verbose_name_plural = "Reviews" | ||
|
||
|
||
class ApplicationAdmin(admin.ModelAdmin): | ||
model = Application | ||
inlines = [CentralGovernmentAttributesInline, ReviewInline] | ||
|
||
|
||
admin.site.unregister(User) | ||
admin.site.register(User, DomainRegistrationUserAdmin) | ||
|
||
admin.site.unregister(Group) | ||
admin.site.register(Group, DomainRegistrationGroupAdmin) | ||
|
||
admin.site.register(Application, ApplicationAdmin) |
Oops, something went wrong.