Git Product home page Git Product logo

Comments (5)

jsocol avatar jsocol commented on June 27, 2024 2

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

from django-adminplus.

oliwarner avatar oliwarner commented on June 27, 2024 1

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.

from django-adminplus.

pkrefta avatar pkrefta commented on June 27, 2024

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

from django-adminplus.

jsocol avatar jsocol commented on June 27, 2024

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}.

from django-adminplus.

jsocol avatar jsocol commented on June 27, 2024

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

from django-adminplus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.