Skip to content

Commit

Permalink
Clean up admin site and eultheme and django-downtime integration
Browse files Browse the repository at this point in the history
- register downtime and eultheme banner models with local admin site
- include eultheme downtime banner in the messages block of the
  django-admin-bootstrapped base template
- simplify templates to reduce duplication
- remove old templates no longer in use
- remove eullocal dependency now that we are using django-auth-ldap

[#109639994]
  • Loading branch information
rlskoeser committed Feb 23, 2016
1 parent dba0569 commit ebe946b
Show file tree
Hide file tree
Showing 24 changed files with 88 additions and 552 deletions.
15 changes: 15 additions & 0 deletions pidman/admin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from django.contrib.admin import AdminSite
from django.contrib import auth
from downtime.models import Period
from eultheme.models import Banner

import sequences

class PidmanAdminSite(AdminSite):
Expand All @@ -13,3 +16,15 @@ class PidmanAdminSite(AdminSite):
admin_site.register(auth.models.Group, auth.admin.GroupAdmin)
admin_site.register(auth.models.User, auth.admin.UserAdmin)
admin_site.register(sequences.models.Sequence, sequences.admin.Sequence)
# eultheme / downtime
admin_site.register(Period)
admin_site.register(Banner)


def template_settings(request):
'''Template context processor to add settings for use on any page.'''

context_extras = {
'site_title': PidmanAdminSite.site_header
}
return context_extras
7 changes: 5 additions & 2 deletions pidman/pid/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,11 @@ class PidAdmin(admin.ModelAdmin):
list_display = ('pid', 'truncated_name', 'type', 'created_at', 'updated_at',
"domain", "primary_target_uri", "is_active", 'linkcheck_status')
# filters: collection/domain, creator/user, type (ark/purl), date ranges (created or modified)
list_filter = ['type', 'domain', 'ext_system', 'creator', 'created_at',
'updated_at']
list_filter = (
'type', ('domain', admin.RelatedOnlyFieldListFilter),
'ext_system',
('creator', admin.RelatedOnlyFieldListFilter),
'created_at', 'updated_at')
form = PidAdminForm

# now possible in django 1.1 - fields to use here?
Expand Down
39 changes: 4 additions & 35 deletions pidman/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,12 @@
'django.contrib.staticfiles',
'mptt',
'linkcheck',
'eullocal.django.emory_ldap',
'django.contrib.humanize',
'django.contrib.sitemaps',
'sequences',
'eultheme',
'downtime',
'widget_tweaks',

'pidman.pid',
'pidman.resolver',
'pidman.rest_api',
Expand All @@ -64,38 +62,9 @@
# Tell nose to measure coverage
NOSE_ARGS = [
'--with-coverage',
'--cover-package=pid,resolver,rest_api',
'--cover-package=pidman',
]

# TEMPLATES = [
# {
# 'BACKEND': 'django.template.backends.django.DjangoTemplates',
# 'DIRS': [
# os.path.join(BASE_DIR, 'templates'),
# ],
# # 'APP_DIRS': True,
# 'OPTIONS': {
# 'context_processors': [
# # django default context processors
# "django.contrib.auth.context_processors.auth",
# "django.core.context_processors.debug",
# "django.core.context_processors.i18n",
# "django.core.context_processors.media",
# "django.contrib.messages.context_processors.messages",
# 'eultheme.context_processors.template_settings',
# # additional context processors
# "django.core.context_processors.request", # always include request in render context
# "django.core.context_processors.static",
# # social auth support
# "eultheme.context_processors.template_settings",
# "eultheme.context_processors.site_path",
# "eultheme.context_processors.downtime_context",
# ],
# },
# },
# ]


TEMPLATE_CONTEXT_PROCESSORS = (
# django default context processors
"django.contrib.auth.context_processors.auth",
Expand All @@ -107,10 +76,12 @@
# additional context processors
"django.core.context_processors.request", # always include request in render context
"django.core.context_processors.static",
# social auth support
# eultheme
"eultheme.context_processors.template_settings",
"eultheme.context_processors.site_path",
"eultheme.context_processors.downtime_context",
# local
'pidman.admin.template_settings',
)

# List of callables that know how to import templates from various sources.
Expand Down Expand Up @@ -176,8 +147,6 @@
# exempted paths for downtime; exempts any urls starting with these strings
DOWNTIME_EXEMPT_PATHS = (
'/admin',
'/indexdata',
'/sitemap'
)

try:
Expand Down
25 changes: 0 additions & 25 deletions pidman/templates/403.html

This file was deleted.

21 changes: 0 additions & 21 deletions pidman/templates/404.html

This file was deleted.

27 changes: 0 additions & 27 deletions pidman/templates/500.html

This file was deleted.

14 changes: 0 additions & 14 deletions pidman/templates/access_logs.html

This file was deleted.

84 changes: 0 additions & 84 deletions pidman/templates/admin/base.html

This file was deleted.

11 changes: 0 additions & 11 deletions pidman/templates/admin/base_site.html

This file was deleted.

Loading

0 comments on commit ebe946b

Please sign in to comment.