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
Python books free to read online or download

Python books free to read online or download

Paolo Amoroso 3.7k Jan 08, 2023
spider-admin-pro

Spider Admin Pro Github: https://github.com/mouday/spider-admin-pro Gitee: https://gitee.com/mouday/spider-admin-pro Pypi: https://pypi.org/

mouday 289 Jan 06, 2023
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 02, 2022
Extends the Django Admin to include a extensible dashboard and navigation menu

django-admin-tools django-admin-tools is a collection of extensions/tools for the default django administration interface, it includes: a full feature

Django Admin Tools 731 Dec 28, 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
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
Jinja is a fast, expressive, extensible templating engine.

Jinja is a fast, expressive, extensible templating engine. Special placeholders in the template allow writing code similar to Python syntax.

The Pallets Projects 9k Jan 04, 2023
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
📱 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 02, 2022
A python application for manipulating pandas data frames from the comfort of your web browser

A python application for manipulating pandas data frames from the comfort of your web browser. Data flows are represented as a Directed Acyclic Graph, and nodes can be ran individually as the user se

Schlerp 161 Jan 04, 2023
Video Visual Relation Detection (VidVRD) tracklets generation. also for ACM MM Visual Relation Understanding Grand Challenge

VidVRD-tracklets This repository contains codes for Video Visual Relation Detection (VidVRD) tracklets generation based on MEGA and deepSORT. These tr

25 Dec 21, 2022
Real-time monitor and web admin for Celery distributed task queue

Flower Flower is a web based tool for monitoring and administrating Celery clusters. Features Real-time monitoring using Celery Events Task progress a

Mher Movsisyan 5.5k Dec 28, 2022
Awesome Video Datasets

Awesome Video Datasets

Yunhua Zhang 462 Jan 02, 2023
A configurable set of panels that display various debug information about the current request/response.

Django Debug Toolbar The Django Debug Toolbar is a configurable set of panels that display various debug information about the current request/respons

Jazzband 7.3k Dec 31, 2022
Simple and extensible administrative interface framework for Flask

Flask-Admin The project was recently moved into its own organization. Please update your references to Flask-Admin 5.2k Dec 29, 2022

Allow foreign key attributes in list_display with '__'

django-related-admin Allow foreign key attributes in Django admin change list list_display with '__' This is based on DjangoSnippet 2996 which was mad

Petr Dlouhý 62 Nov 18, 2022
Django app that enables staff to log in as other users using their own credentials.

Impostor Impostor is a Django application which allows staff members to login as a different user by using their own username and password. Login Logg

Andreu Vallbona Plazas 144 Dec 13, 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
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
Collection of admin fields and decorators to help to create computed or custom fields more friendly and easy way

django-admin-easy Collection of admin fields, decorators and mixin to help to create computed or custom fields more friendly and easy way Installation

Ezequiel Bertti 364 Jan 08, 2023