removed django-admin-tools (#22626)

This commit is contained in:
Elias Showk 2018-05-25 15:14:10 +02:00
parent 0445badc95
commit 49420b2b96
17 changed files with 4 additions and 297 deletions

View File

@ -14,7 +14,6 @@ Pre-Depends: python-django (>= 1.8), python-django (<< 1.9), openssl
Depends: ${misc:Depends}, ${python:Depends},
python-requests (>=2.3),
python-django-model-utils (>= 2.4),
python-django-admin-tools (>= 0.5.2),
python-lasso (>= 2.4.1.100),
python-dnspython (>= 1.10),
python-django-select2 (>= 5),

View File

@ -14,7 +14,6 @@ Pre-Depends: python-django (>= 1.8), python-django (<< 1.8), openssl
Depends: ${misc:Depends}, ${python:Depends},
python-requests (>=2.3),
python-django-model-utils (>= 2.4),
python-django-admin-tools (>= 0.5.2),
python-lasso (>= 2.4.1.100),
python-dnspython (>= 1.10),
python-django-select2 (>= 5),

View File

@ -17,7 +17,6 @@ The other Authentic 2 dependencies are:
- Django>=1.7.6,<1.9
- requests>=2.
- django-model-utils>=2
- django-admin-tools>=0.5.2
- dnspython>=1.12
- django-select2>=4.3.0
- django-tables2>=1.0

View File

@ -26,13 +26,9 @@ class Plugin(object):
def get_idp_backends(self):
return []
def get_admin_modules(self):
from . import dashboard
return dashboard.get_admin_modules()
def service_list(self, request):
'''For IdP plugins this method add links to the user homepage.
It must return a list of authentic2.utils.Service objects, each
object has a name and can have an url and some actions.
@ -49,7 +45,7 @@ class Plugin(object):
def logout_list(self, request):
'''For IdP or SP plugins this method add actions to logout from remote
IdP or SP.
It must returns a list of HTML fragments, each fragment is
responsible for calling the view doing the logout. Views are usually
called using <img/> or <iframge/> tags and finally redirect to an

View File

@ -1,11 +0,0 @@
from django.utils.translation import ugettext_lazy as _
from admin_tools.dashboard import modules
def get_admin_modules():
'''Show Client model in authentic2 admin'''
model_list = modules.ModelList(_('Authentic2 Plugin Template'),
models=('authentic2_plugin_template.models.*',))
return (model_list,)

View File

@ -112,7 +112,6 @@ setup(name="authentic2",
'django>=1.8,<1.9',
'requests>=2.3',
'django-model-utils>=2.4',
'django-admin-tools>=0.6,<0.7',
'dnspython>=1.10',
'Django-Select2>5,<6',
'django-tables2>=1.0,<1.1',

View File

@ -38,7 +38,6 @@ class ThirdPartyAlterField(migrations.AlterField):
class Migration(migrations.Migration):
dependencies = [
('custom_user', '0001_initial'),
('menu', '__first__'),
('admin', '__first__'),
]
@ -55,12 +54,4 @@ class Migration(migrations.Migration):
field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
preserve_default=True
),
# Django admin-tools menu bookmark
ThirdPartyAlterField(
app_label='menu',
model_name='bookmark',
name='user',
field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
preserve_default=True
),
]

View File

@ -1,130 +0,0 @@
"""
This file was generated with the customdashboard management command, it
contains the two classes for the main dashboard and app index dashboard.
You can customize these classes as you want.
To activate your index dashboard add the following to your settings.py::
ADMIN_TOOLS_INDEX_DASHBOARD = 'authentic2.dashboard.CustomIndexDashboard'
And to activate the app index dashboard::
ADMIN_TOOLS_APP_INDEX_DASHBOARD = 'authentic2.dashboard.CustomAppIndexDashboard'
"""
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse
from admin_tools.dashboard import modules, Dashboard, AppIndexDashboard
from admin_tools.utils import get_admin_site_name
from . import plugins, compat
class CustomIndexDashboard(Dashboard):
"""
Custom index dashboard for authentic2.
"""
def init_with_context(self, context):
site_name = get_admin_site_name(context)
# append a link list module for "quick links"
self.children.append(modules.LinkList(
_('Quick links'),
layout='inline',
draggable=False,
deletable=False,
collapsible=False,
children=[
[_('Return to site'), '/'],
[_('Change password'),
reverse('%s:password_change' % site_name)],
[_('Log out'), reverse('%s:logout' % site_name)],
]
))
# append an app list module for "Applications"
User = compat.get_user_model()
user_class = '{0}.{1}'.format(User.__module__, User.__name__)
self.children.append(modules.ModelList(
_('Users and groups'),
models=(user_class,
'django.contrib.auth.models.*',
'authentic2.models.Attribute',
'authentic2.models.PasswordReset'),
))
self.children.append(modules.ModelList(
_('Access control'),
models=('authentic2.a2_rbac.models.OrganizationalUnit',
'authentic2.a2_rbac.models.Role',
'authentic2.a2_rbac.models.Permission',
'authentic2.models.ServiceRole',
),
))
self.children.append(modules.ModelList(
_('Debug'),
models=(
'authentic2.models.AttributeValue',
'authentic2.nonce.models.Nonce',
'authentic2.models.LogoutUrl',
'authentic2.models.AuthenticationEvent',
'authentic2.models.UserExternalId',
'authentic2.models.DeletedUser',
'django.contrib.sessions.*',
),
))
for plugin in plugins.get_plugins():
if hasattr(plugin, 'get_admin_modules') and callable(plugin.get_admin_modules):
plugin_modules = plugin.get_admin_modules()
for module in plugin_modules:
self.children.append(module)
# append a recent actions module
self.children.append(modules.RecentActions(_('Recent Actions'), 5))
# append another link list module for "support".
self.children.append(modules.LinkList(
_('Support'),
children=[
{
'title': _('Authentic2 documentation'),
'url': 'http://pythonhosted.org/authentic2/',
'external': True,
},
{
'title': _('Authentic2 project'),
'url': 'http://dev.entrouvert.org/projects/authentic/',
'external': True,
},
{
'title': _('Authentic Mailing List'),
'url': 'http://listes.entrouvert.com/info/authentic',
'external': True,
},
]
))
class CustomAppIndexDashboard(AppIndexDashboard):
"""
Custom app index dashboard for authentic2.
"""
# we disable title because its redundant with the model list module
title = ''
def __init__(self, *args, **kwargs):
AppIndexDashboard.__init__(self, *args, **kwargs)
# append a model list module and a recent actions module
self.children += [
modules.ModelList(self.app_title, self.models),
modules.RecentActions(
_('Recent Actions'),
include_list=self.get_app_content_types(),
limit=5
)
]
def init_with_context(self, context):
"""
Use this method if you need to access the request context.
"""
return super(CustomAppIndexDashboard, self).init_with_context(context)

View File

@ -1,33 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='DashboardPreferences',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('data', models.TextField()),
('dashboard_id', models.CharField(max_length=100)),
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
],
options={
'ordering': ('user',),
'db_table': 'admin_tools_dashboard_preferences',
},
bases=(models.Model,),
),
migrations.AlterUniqueTogether(
name='dashboardpreferences',
unique_together=set([('user', 'dashboard_id')]),
),
]

View File

@ -22,17 +22,6 @@ class Plugin(object):
def get_apps(self):
return ['authentic2.idp.saml']
def get_admin_modules(self):
from admin_tools.dashboard import modules
return [modules.ModelList(
_('SAML2'),
models=(
'authentic2.saml.models.LibertyProvider',
'authentic2.saml.models.SPOptionsIdPPolicy',
'authentic2.saml.models.IdPOptionsSPPolicy',
),
)]
def get_idp_backends(self):
return ['authentic2.idp.saml.backend.SamlBackend']

View File

@ -1,30 +0,0 @@
"""
This file was generated with the custommenu management command, it contains
the classes for the admin menu, you can customize this class as you want.
To activate your custom menu add the following to your settings.py::
ADMIN_TOOLS_MENU = 'authentic2.menu.CustomMenu'
"""
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from admin_tools.menu import items, Menu
class CustomMenu(Menu):
"""
Custom Menu for authentic2 admin site.
"""
def __init__(self, **kwargs):
Menu.__init__(self, **kwargs)
self.children += [
items.MenuItem(_('Dashboard'), reverse('admin:index')),
items.Bookmarks(),
]
def init_with_context(self, context):
"""
Use this method if you need to access the request context.
"""
return super(CustomMenu, self).init_with_context(context)

View File

@ -1,29 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Bookmark',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('url', models.CharField(max_length=255)),
('title', models.CharField(max_length=255)),
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
],
options={
'ordering': ('id',),
'db_table': 'admin_tools_menu_bookmark',
},
bases=(models.Model,),
),
]

View File

@ -113,10 +113,6 @@ INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.sessions',
'django.contrib.messages',
'admin_tools',
'admin_tools.theming',
'admin_tools.menu',
'admin_tools.dashboard',
'django.contrib.admin',
'django_select2',
'django_tables2',

View File

@ -24,7 +24,6 @@ not_homepage_patterns = [
not_homepage_patterns += [
url(r'^accounts/', include(app_settings.A2_REGISTRATION_URLCONF)),
url(r'^admin/', include(admin.site.urls)),
url(r'^admin_tools/', include('admin_tools.urls')),
url(r'^idp/', include('authentic2.idp.urls')),
url(r'^manage/', include('authentic2.manager.urls')),
url(r'^api/', include('authentic2.api_urls'))

View File

@ -66,12 +66,3 @@ class Plugin(object):
return
logger.info(u'revoked token from OIDC provider %s', provider.issuer)
def get_admin_modules(self):
from admin_tools.dashboard import modules
return [modules.ModelList(
_('OpenID Connect authentication'),
models=(
'authentic2_auth_oidc.models.OIDCProvider',
'authentic2_auth_oidc.models.OIDCAccount',
),
)]

View File

@ -30,13 +30,4 @@ class Plugin(object):
}
content = render_to_string('authentic2_idp_cas/logout_fragment.html', ctx)
fragments.append(content)
return fragments
def get_admin_modules(self):
from admin_tools.dashboard import modules
return [modules.ModelList(
_('CAS'),
models=(
'%s.*' % __name__,
),
)]
return fragments

View File

@ -31,13 +31,4 @@ class Plugin(object):
render_to_string(
'authentic2_idp_oidc/logout_fragment.html',
ctx))
return fragments
def get_admin_modules(self):
from admin_tools.dashboard import modules
return [modules.ModelList(
_('OpenID Connect authentication'),
models=(
'authentic2_idp_oidc.models.*',
),
)]
return fragments