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
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
StyleCLIP: Text-Driven Manipulation of StyleGAN Imagery

StyleCLIP: Text-Driven Manipulation of StyleGAN Imagery

3.3k Jan 01, 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
There is a new admin bot by @sinan-m-116 .

find me on telegram! deploy me on heroku, use below button: If you can't have a config.py file (EG on heroku), it is also possible to use environment

Sinzz-sinan-m 0 Nov 09, 2021
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
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

2.6k Jan 07, 2023
手部21个关键点检测,二维手势姿态,手势识别,pytorch,handpose

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

Eric.Lee 321 Dec 30, 2022
Material Design for Django

Django Material Material design for Django. Django-Material 1.7.x compatible with Django 1.11/2.0/2.1/2.2/3.0/3.1 Django-Material 1.6.x compatible wit

Viewflow 2.5k Jan 01, 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
Awesome Video Datasets

Awesome Video Datasets

Yunhua Zhang 462 Jan 02, 2023
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
BitcartCC is a platform for merchants, users and developers which offers easy setup and use.

BitcartCC is a platform for merchants, users and developers which offers easy setup and use.

BitcartCC 270 Jan 07, 2023
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
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
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
xarray: N-D labeled arrays and datasets

xarray is an open source project and Python package that makes working with labelled multi-dimensional arrays simple, efficient, and fun!

Python for Data 2.8k Dec 29, 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
DyStyle: Dynamic Neural Network for Multi-Attribute-Conditioned Style Editing

DyStyle: Dynamic Neural Network for Multi-Attribute-Conditioned Style Editing

74 Dec 03, 2022
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
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