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
Code to reproduce experiments in the paper "Task-Oriented Dialogue as Dataflow Synthesis" (TACL 2020).

Code to reproduce experiments in the paper "Task-Oriented Dialogue as Dataflow Synthesis" (TACL 2020).

Microsoft 274 Dec 28, 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
手部21个关键点检测,二维手势姿态,手势识别,pytorch,handpose

手部21个关键点检测,二维手势姿态,手势识别,pytorch,handpose

Eric.Lee 321 Dec 30, 2022
FastAPI Admin Dashboard based on FastAPI and Tortoise ORM.

FastAPI ADMIN 中文文档 Introduction FastAPI-Admin is a admin dashboard based on fastapi and tortoise-orm. FastAPI-Admin provide crud feature out-of-the-bo

long2ice 1.6k Jan 02, 2023
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
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-admin fixture generator command

Mockango for short mockango is django fixture generator command which help you have data without pain for test development requirements pip install dj

Ilia Rastkhadiv 14 Oct 29, 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
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
Freqtrade is a free and open source crypto trading bot written in Python

Freqtrade is a free and open source crypto trading bot written in Python. It is designed to support all major exchanges and be controlled via Telegram. It contains backtesting, plotting and money man

20.2k Jan 02, 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
WebVirtCloud is virtualization web interface for admins and users

WebVirtCloud is a virtualization web interface for admins and users. It can delegate Virtual Machine's to users. A noVNC viewer presents a full graphical console to the guest domain. KVM is currently

Anatoliy Guskov 1.3k Dec 29, 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

1.6k Dec 28, 2022
A high-level app and dashboarding solution for Python

Panel provides tools for easily composing widgets, plots, tables, and other viewable objects and controls into custom analysis tools, apps, and dashboards.

HoloViz 2.5k Jan 03, 2023
Awesome Video Datasets

Awesome Video Datasets

Yunhua Zhang 462 Jan 02, 2023
Python Crypto Bot

Python Crypto Bot

Michael Whittle 1.6k Jan 06, 2023
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
With Django Hijack, admins can log in and work on behalf of other users without having to know their credentials.

Django Hijack With Django Hijack, admins can log in and work on behalf of other users without having to know their credentials. Docs 3.x docs are avai

1.2k Jan 02, 2023
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
Manuskript is an open-source tool for writers.

Manuskript is an open-source tool for writers. Manuskript runs on GNU/Linux, Mac OS X, and Windows.

Olivier 1.4k Jan 07, 2023