Extendable, adaptable rewrite of django.contrib.admin

Overview

django-admin2

Jazzband GitHub Actions Code coverage

One of the most useful parts of django.contrib.admin is the ability to configure various views that touch and alter data. django-admin2 is a complete rewrite of that library using modern Class-Based Views and enjoying a design focused on extendibility and adaptability. By starting over, we can avoid the legacy code and make it easier to write extensions and themes.

Full Documentation at: https://django-admin2.readthedocs.io/

Features

  • Rewrite of the Django Admin backend
  • Drop-in themes
  • Built-in RESTful API

Screenshots

Site administration Select user

Requirements

Installation

Use pip to install from PyPI:

pip install django-admin2

Add djadmin2 and rest_framework to your settings file:

INSTALLED_APPS = (
    ...
    'djadmin2',
    'rest_framework', # for the browsable API templates
    ...
)

Add setting for apps and the default theme in your settings file:

# In settings.py
INSTALLED_APPS += ('djadmin2.themes.djadmin2theme_bootstrap3',)
REST_FRAMEWORK = {
    'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
    'PAGE_SIZE': 10
}
ADMIN2_THEME_DIRECTORY = "djadmin2theme_bootstrap3"

Add djadmin2 urls to your URLconf:

# urls.py
from django.conf.urls import include

from djadmin2.site import djadmin2_site

djadmin2_site.autodiscover()

urlpatterns = [
  ...
  url(r'^admin2/', include(djadmin2_site.urls)),
]

How to write django-admin2 modules

# myapp/admin2.py
# Import your custom models
from django.contrib.auth.forms import UserCreationForm, UserChangeForm
from django.contrib.auth.models import User
from djadmin2.site import djadmin2_site
from djadmin2.types import ModelAdmin2

from .models import Post, Comment


class UserAdmin2(ModelAdmin2):
    # Replicates the traditional admin for django.contrib.auth.models.User
    create_form_class = UserCreationForm
    update_form_class = UserChangeForm


#  Register each model with the admin
djadmin2_site.register(Post)
djadmin2_site.register(Comment)
djadmin2_site.register(User, UserAdmin2)

Migrating from 0.6.x

  • The default theme has been updated to bootstrap3, be sure to replace your reference to the new one.
  • Django rest framework also include multiple pagination system, the only one supported now is the PageNumberPagination.

Therefore, your settings need to include this:

# In settings.py
INSTALLED_APPS += ('djadmin2.themes.djadmin2theme_bootstrap3',)
ADMIN2_THEME_DIRECTORY = "djadmin2theme_bootstrap3"

REST_FRAMEWORK = {
    'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
    'PAGE_SIZE': 10
}

The default admin2 site has move into djadmin2.site make sure your use the news djadmin2_site in your urls.py:

# urls.py
from django.conf.urls import include

from djadmin2.site import djadmin2_site

djadmin2_site.autodiscover()

urlpatterns = [
  ...
  url(r'^admin2/', include(djadmin2_site.urls)),
]

Migrating from 0.5.x

Themes are now defined explicitly, including the default theme. Therefore, your settings need to include this:

# In settings.py
INSTALLED_APPS += ('djadmin2.themes.djadmin2theme_default',)
ADMIN2_THEME_DIRECTORY = "djadmin2theme_default"

Drop-In Themes

The default theme is whatever bootstrap is most current. Specifically:

# In settings.py
INSTALLED_APPS += ('djadmin2.themes.djadmin2theme_bootstrap3',)
ADMIN2_THEME_DIRECTORY = "djadmin2theme_bootstrap3"

If you create a new theme, you define it thus:

# In settings.py
# Mythical theme! This does not exit... YET!
INSTALLED_APPS += ('djadmin2theme_foundation',)
ADMIN2_THEME_DIRECTORY = "djadmin2theme_foundation"

Code of Conduct

Everyone interacting in the django-admin2 project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the Jazzband Code of Conduct.

Follows Best Practices

This project follows best practices as espoused in Two Scoops of Django: Best Practices for Django 1.8.

Comments
  • Potential state linkage between the view and the ModelAdmin2 object passed in the request

    Potential state linkage between the view and the ModelAdmin2 object passed in the request

    If the view, which is called by the urls generated by the ModelAdmin object and yet receives a reference to the ModelAdmin as passed in as_view() modifies the state of the ModelAdmin object, then everyone sees that new data.

    This can be mitigated in three ways:

    1. Document the issue and encourage developers not to change state on the ModelAdmin2 object. (Potential for a catastrophic developer-user mistake but is the django.contrib.admin standard)
    2. Remove the passing of the ModelAdmin2 object (Will require major refactoring - @freakboy3742's preference).
    3. Make a copy of the object that does not allow for state changes (Is a bit tricky but not insurmountable, unfortunately has potential performance problems).

    Occurs: models.ModelAdmin2.get_default_view_kwargs

    enhancement Priority 
    opened by pydanny 21
  • Make it easy to add new views to a ModelAdmin2 subclass

    Make it easy to add new views to a ModelAdmin2 subclass

    As discussed with @pydanny during the djangocon.eu sprints, we said that it is essential to have a very easy to use way to add additional views to a ModelAdmin and to swap out existing ones.

    opened by gregmuellegger 17
  • Decouple Bootstrap classes / make templates more future-proof

    Decouple Bootstrap classes / make templates more future-proof

    reading the preliminary docs it should be possible to change themes with adding a new theme path. that looks nice ... however, bootstrap uses different classes than foundation (and a customized theme could use different classes as well). now, if one changes the theme (say from bootstrap to foundation) there's a good chance most 3rd–party apps won't work anymore, right?

    maybe I'm missing something, but I think it's a good idea to lay ground for all apps to work with the same (DOM–)structure. not sure how to solve this though.

    opened by sehmaschine 14
  • Internationalization

    Internationalization

    I have some open questions about i18n.

    • Do we have to compile the messages every time we update the .po files?
    • Do we commit the .mo files to the repository?
    • How do I compile the messages for djadmin2? It always complains about a missing settings.py...
    • Should we add i18n_patterns to the example apps? Maybe with a comment that you can leave it away in single-language-only projects? Or should we leave that to the user?

    Probably @NotSqrt or @jezdez can answer all of those.

    opened by dbrgn 11
  • themes folder not inluded in pip instalation

    themes folder not inluded in pip instalation

    after pip install django-admin2, and setting up it on django project, i got an importerror that there is no module named themes.djadmin2theme_default. checked my env folder, and of course there was no folder themes. then downloaded source from pypi. it does not contain themes folder

    opened by montiniz 8
  • Create second example project

    Create second example project

    The blog application is good, but the problem is that it was written by the current set of contributors. Requirements:

    1. New contributor involvement. If you've submitted a pull request to django-admin2, this is not the ticket for you.
    2. The new project needs to be called 'example2'.
    3. It needs to be relatively simple in scope.
    4. It cannot be a blog application.
    opened by pydanny 8
  • API versioning

    API versioning

    In docs/api.rst we imply that the API version number will change when admin2 changes. However, I think this is backwards: it should be the responsibility of the user admin2 to update the version number, since they might want to change the API that they expose to their end users.

    As such, we'll need to provide a mechanism for a user to associate a ModelAdmin2 with an API version.

    This might look like:

    class BlogAdmin(ModelAdmin2):
        version = 2
        ...
    

    This version attribute would then be used to construct the URLs.

    Thoughts?

    opened by inglesp 8
  • Inlines separated into stacked and tabular, fixes #334

    Inlines separated into stacked and tabular, fixes #334

    Uses similair approach as the old admin. Different template is set on the inline class for tabular and stacked.

    Admin2Inline can no longer be used as inline directly, therefore I also changed the import in init to use tabular as a fallback to ease migration to this version.

    Examples are updated to use tabular instead. Maybe one of them should use stacked, just for the sake of using it?

    Not sure how to add tests for this. Admin2Inline is kind of icky to initialize. Suggestions are welcome.

    opened by ludw 7
  • Permission refactoring

    Permission refactoring

    This is my shot of a permission handling system as kind of previewed in ticket #96. I think that it is really a very flexible and easy to use way of handling permissions. It includes tests and docs.

    Documentation can be previewed here: http://gregmuellegger.github.io/django-admin2/permission-refactoring/reference.html#permissions

    opened by gregmuellegger 7
  • Actions

    Actions

    Here's an implementation of admin actions.

    Am currently on a train and about to lose wifi access... I've got a bunch of things we need to discuss about this approach, and so will write up tonight.

    This addresses #71.

    opened by inglesp 7
  • New bootstrap3 default theme + Remove django-crispy-forms and django-floppyforms

    New bootstrap3 default theme + Remove django-crispy-forms and django-floppyforms

    I update the default theme to a bootstrap3 theme.

    The new theme is based on sb-admin2. I just write some custom code to hide the sidebar.

    The new theme also provide less and sass files

    Resolve #360

    opened by arthur-wsw 6
  • docs: Fix a few typos

    docs: Fix a few typos

    There are small typos in:

    • djadmin2/actions.py
    • djadmin2/views.py
    • docs/ref/actions.rst
    • docs/ref/meta.rst
    • docs/ref/permissions.rst
    • example/blog/tests/test_views.py

    Fixes:

    • Should read separated rather than seperated.
    • Should read response rather than reponse.
    • Should read objects rather than obejcts.
    • Should read modifying rather than modifing.
    • Should read limited rather than limitted.
    • Should read explicitly rather than explicityly.
    • Should read execute rather than exectue.
    • Should read embarrassing rather than embarressing.
    • Should read denied rather than diened.

    Semi-automated pull request generated by https://github.com/timgates42/meticulous/blob/master/docs/NOTE.md

    opened by timgates42 1
  • Deregister last app model does not delete the app

    Deregister last app model does not delete the app

    When using deregister to delete User and Group, the auth app still appear in the Dashboard but no more models are registered.

    When all models off an apps are deregistered the app should be removed.

    opened by arthur-wsw 0
Releases(0.7.1)
  • 0.7.1(Jan 10, 2017)

  • 0.7.0(Nov 15, 2016)

    • Fix Django 1.8 issues and add 1.9, 1.10 compatibility
    • Update django-rest-framework to 3.3.x
    • Remove django-crispy-forms and django-floppyforms
    • Regenerate example project to make it django 1.9 compatible
    • Update tox and travis and add flake8
    • Rename AdminModel2Mixin to Admin2ModelMixin
    • Add migrations
    • remove south migrations
    • Replace IPAddressField with GenericIPAddressField
    • Fix password link in user admin
    • Fix user logout on password change
    • Fix tests
    • Drop support of django versions lower then 1.8
    • Drop older url.patterns
    Source code(tar.gz)
    Source code(zip)
Owner
Jazzband
Jazzband
fastapi-admin is a fast admin dashboard based on FastAPI and TortoiseORM with tabler ui, inspired by Django admin.

fastapi-admin is a fast admin dashboard based on FastAPI and TortoiseORM with tabler ui, inspired by Django admin.

fastapi-admin 1.6k Dec 30, 2022
Jet Bridge (Universal) for Jet Admin – API-based Admin Panel Framework for your application

Jet Bridge for Jet Admin – Admin panel framework for your application Description About Jet Admin: https://about.jetadmin.io Live Demo: https://app.je

Jet Admin 1.3k Dec 27, 2022
aiohttp admin is generator for admin interface based on aiohttp

aiohttp admin is generator for admin interface based on aiohttp

Mykhailo Havelia 17 Nov 16, 2022
📱 An extension for Django admin that makes interface mobile-friendly. Merged into Django 2.0

Django Flat Responsive django-flat-responsive is included as part of Django from version 2.0! ?? Use this app if your project is powered by an older D

elky 248 Sep 2, 2022
An improved django-admin-tools dashboard for Django projects

django-fluent-dashboard The fluent_dashboard module offers a custom admin dashboard, built on top of django-admin-tools (docs). The django-admin-tools

django-fluent 326 Nov 9, 2022
A Django app for easily adding object tools in the Django admin

Django Object Actions If you've ever tried making admin object tools you may have thought, "why can't this be as easy as making Django Admin Actions?"

Chris Chang 524 Dec 26, 2022
Disable dark mode in Django admin user interface in Django 3.2.x.

Django Non Dark Admin Disable or enable dark mode user interface in Django admin panel (Django==3.2). Installation For install this app run in termina

Artem Galichkin 6 Nov 23, 2022
Modern responsive template for the Django admin interface with improved functionality. We are proud to announce completely new Jet. Please check out Live Demo

Django JET Modern template for Django admin interface with improved functionality Attention! NEW JET We are proud to announce completely new Jet. Plea

Geex Arts 3.4k Dec 29, 2022
Drop-in replacement of Django admin comes with lots of goodies, fully extensible with plugin support, pretty UI based on Twitter Bootstrap.

Xadmin Drop-in replacement of Django admin comes with lots of goodies, fully extensible with plugin support, pretty UI based on Twitter Bootstrap. Liv

差沙 4.7k Dec 31, 2022
A jazzy skin for the Django Admin-Interface (official repository).

Django Grappelli A jazzy skin for the Django admin interface. Grappelli is a grid-based alternative/extension to the Django administration interface.

Patrick Kranzlmueller 3.4k Dec 31, 2022
A Django admin theme using Twitter Bootstrap. It doesn't need any kind of modification on your side, just add it to the installed apps.

django-admin-bootstrapped A Django admin theme using Bootstrap. It doesn't need any kind of modification on your side, just add it to the installed ap

null 1.6k Dec 28, 2022
django's default admin interface made customizable. popup windows replaced by modals. :mage: :zap:

django-admin-interface django-admin-interface is a modern responsive flat admin interface customizable by the admin itself. Features Beautiful default

Fabio Caccamo 1.3k Dec 31, 2022
Modern theme for Django admin interface

Django Suit Modern theme for Django admin interface. Django Suit is alternative theme/skin/extension for Django administration interface. Project home

Kaspars Sprogis 2.2k Dec 29, 2022
Django application and library for importing and exporting data with admin integration.

django-import-export django-import-export is a Django application and library for importing and exporting data with included admin integration. Featur

null 2.6k Jan 7, 2023
:honey_pot: A fake Django admin login screen page.

django-admin-honeypot django-admin-honeypot is a fake Django admin login screen to log and notify admins of attempted unauthorized access. This app wa

Derek Payton 907 Dec 31, 2022
"Log in as user" for the Django admin.

django-loginas About "Login as user" for the Django admin. loginas supports Python 3 only, as of version 0.4. If you're on 2, use 0.3.6. Installing dj

Stavros Korokithakis 326 Dec 3, 2022
Visually distinguish environments in Django Admin

django-admin-env-notice Visually distinguish environments in Django Admin. Based on great advice from post: 5 ways to make Django Admin safer by hakib

Yuri Shikanov 258 Nov 30, 2022
A new style for Django admin

Djamin Djamin a new and clean styles for Django admin based in Google projects styles. Quick start Install djamin: pip install -e git://github.com/her

Herson Leite 236 Dec 15, 2022
Responsive Theme for Django Admin With Sidebar Menu

Responsive Django Admin If you're looking for a version compatible with Django 1.8 just install 0.3.7.1. Features Responsive Sidebar Menu Easy install

Douglas Miranda 852 Dec 2, 2022