Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Django 2.x support #61

Closed
stavlocker opened this issue Aug 27, 2018 · 5 comments
Closed

Django 2.x support #61

stavlocker opened this issue Aug 27, 2018 · 5 comments

Comments

@stavlocker
Copy link

stavlocker commented Aug 27, 2018

Hi, I'd love to see django 2.x get integrated. As far as I can tell there's a PR waiting from January 2018 #58 to support 1.10+ that just doesn't get merged. This package renders unusable for me unless something is done to support 2.1. I'm doing everything by the book and still getting the infamous django.urls.exceptions.NoReverseMatch: Reverse for 'app_list' with keyword arguments '{'app_label': ''}' not found.

@stavlocker stavlocker changed the title Django 2.1 support Django 2.x support Aug 27, 2018
@jsocol
Copy link
Owner

jsocol commented Mar 1, 2019

I've been digging into this and there's been a kind of surprising amount of movement in the admin config area of 2.0 and 2.1 and I'm not sure the best route forward here.

  1. 2.0 changed a bunch of things around URL conf and how they get installed.
  2. There are some details around installing SimpleAdminConfig vs AdminConfig
  3. In 2.1, there's an option to create a custom AdminConfig that can override the default admin site

@oliwarner
Copy link

oliwarner commented Apr 5, 2019

Great point there @jsocol! I just wrote this little appconfig module for our purposes. Note that this is doing more than just installing AdminPlus, it sets titles, wraps with a login required so we can use a central single, central login view.

admin.py:

from django.contrib.admin.apps import AdminConfig
from django.contrib.auth.decorators import login_required

class AdminPlusConfig(AdminConfig):
    default_site = 'adminplus.sites.AdminSitePlus'

    def ready(self):
        super().ready()

        self.module.site.site_title = self.module.site.site_header = 'Our Magic Admin'
        self.module.site.login = login_required(self.module.site.login)

settings.py:

INSTALLED_APPS = [
    'admin.AdminPlusConfig',
    'adminplus',  # needed unless you make that AppConfig "poison" the template dirs
]

urls.py:

from django.contrib import admin
urlpatterns = [
    path('admin/', include(admin.site.urls[:2], admin.site.urls[2])),
]

The site.urls is the only bit that's a bit funky now. If you could make that a Django 2-sensitive @property, that would really minimise the amount of hacking to get this in. Hell, you could even provide a little AppConfig, makes installation just two lines in INSTALLED_APPS.

@pkrefta
Copy link

pkrefta commented May 8, 2020

Hi @jsocol - are there any plans to support Django 2.x ?

@jsocol
Copy link
Owner

jsocol commented May 8, 2020

I would love to get this updated. I imagine this situation described in this comment has gotten better since we no longer have to worry about 2.0 and 2.1, only 2.2 and 3.0. I have not been working in Django day to day recently, though, so I'm not sure how easy it will be to support both 2.2 and 3.0.

I'm extremely open to patches that bring adminplus up to date with 2.2's— and hopefully 3.0's—admin module changes. I hope that the differences are smaller than existed between 2.{0,1,2}.

@jsocol
Copy link
Owner

jsocol commented Dec 5, 2023

The code on main is now tested against Django 3.2, 4.2, and 5.0 (plus some others) and seems to be working. I'm working on cutting a new release today

@jsocol jsocol closed this as completed Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants