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
We are all part of this
Jazzband
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
PyTorch Implementation of Unsupervised Depth Completion with Calibrated Backprojection Layers (ORAL, ICCV 2021)

PyTorch Implementation of Unsupervised Depth Completion with Calibrated Backprojection Layers (ORAL, ICCV 2021)

80 Dec 13, 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
Ajenti Core and stock plugins

Ajenti is a Linux & BSD modular server admin panel. Ajenti 2 provides a new interface and a better architecture, developed with Python3 and AngularJS.

Ajenti Project 7k Jan 07, 2023
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
An administration website for Django

yawd-admin, a django administration website yawd-admin now has a live demo at http://yawd-admin.yawd.eu/. Use demo / demo as username & passowrd. yawd

Pantelis Petridis 140 Oct 30, 2021
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

1.6k Dec 28, 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
Firebase Admin Console is a centralized platform for easy viewing and maintenance of Firestore database, the back-end API is a Python Flask app.

Firebase Admin Console is a centralized platform for easy viewing and maintenance of Firestore database, the back-end API is a Python Flask app. A starting template for developers to customize, build

Daqi Chen 1 Sep 10, 2022
EOD (Easy and Efficient Object Detection) is a general object detection model production framework.

EOD (Easy and Efficient Object Detection) is a general object detection model production framework.

383 Jan 07, 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
: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
Awesome Video Datasets

Awesome Video Datasets

Yunhua Zhang 462 Jan 02, 2023
Tactical RMM is a remote monitoring & management tool for Windows computers, built with Django and Vue.

Tactical RMM is a remote monitoring & management tool for Windows computers, built with Django and Vue. It uses an agent written in golan

Dan 1.4k Dec 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
Extendable, adaptable rewrite of django.contrib.admin

django-admin2 One of the most useful parts of django.contrib.admin is the ability to configure various views that touch and alter data. django-admin2

Jazzband 1.2k Dec 29, 2022
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
Python code for "Machine learning: a probabilistic perspective" (2nd edition)

Python code for "Machine learning: a probabilistic perspective" (2nd edition)

Probabilistic machine learning 5.3k Dec 31, 2022
Nginx UI allows you to access and modify the nginx configurations files without cli.

nginx ui Table of Contents nginx ui Introduction Setup Example Docker UI Authentication Configure the auth file Configure nginx Introduction We use ng

David Schenk 4.3k Dec 31, 2022
Passhunt is a simple tool for searching of default credentials for network devices, web applications and more. Search through 523 vendors and their 2084 default passwords.

Passhunt is a simple tool for searching of default credentials for network devices, web applications and more. Search through 523 vendors and their 2084 default passwords.

Viral Maniar 1.1k Dec 31, 2022