-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #2362: Implemented custom admin site to properly handle BASE_PATH
- Loading branch information
1 parent
cd2aee3
commit ff65f7f
Showing
6 changed files
with
44 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from django.conf import settings | ||
from django.contrib.admin import AdminSite | ||
from django.contrib.auth.models import Group, User | ||
from django.contrib.auth.admin import GroupAdmin, UserAdmin | ||
from taggit.admin import TagAdmin | ||
from taggit.models import Tag | ||
|
||
|
||
class NetBoxAdminSite(AdminSite): | ||
""" | ||
Custom admin site | ||
""" | ||
site_header = 'NetBox Administration' | ||
site_title = 'NetBox' | ||
site_url = '/{}'.format(settings.BASE_PATH) | ||
|
||
|
||
admin_site = NetBoxAdminSite(name='admin') | ||
|
||
# Register external models | ||
admin_site.register(Group, GroupAdmin) | ||
admin_site.register(User, UserAdmin) | ||
admin_site.register(Tag, TagAdmin) | ||
|
||
# Modify the template to include an RQ link if django_rq is installed (see RQ_SHOW_ADMIN_LINK) | ||
try: | ||
import django_rq | ||
admin_site.index_template = 'django_rq/index.html' | ||
except ImportError: | ||
pass |
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