Skip to content

Commit

Permalink
Make adminplus optional
Browse files Browse the repository at this point in the history
  • Loading branch information
jayvdb committed May 11, 2020
1 parent b7442e9 commit a38d3ed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 0 additions & 5 deletions onthefly/admin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from django.contrib import admin
from django.views.generic import TemplateView
from django.conf import settings
from django.contrib import messages
Expand Down Expand Up @@ -59,7 +58,3 @@ def post(self, request, *args, **kwargs):
settings.backend.set_value(name, converted_value)
request.method = 'GET'
return self.get(request, *args, **kwargs)


admin.site.register_view('onthefly-settings/', 'Onthefly Settings',
view=AppSettingsView.as_view())
6 changes: 6 additions & 0 deletions onthefly/apps.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from django.apps import AppConfig
from django.contrib import admin

from onthefly.monkey_patch import patch
from onthefly.admin import AppSettingsView


class OntheflyConfig(AppConfig):
Expand All @@ -11,3 +13,7 @@ def ready(self):
if not self.patched:
patch()
self.patched = True

if hasattr(admin.site, 'register_view'):
admin.site.register_view('onthefly-settings/', 'Onthefly Settings',
view=AppSettingsView.as_view())

0 comments on commit a38d3ed

Please sign in to comment.