Metadata-Version: 2.1
Name: django-admin-utils
Version: 2.0.1
Summary: Utility code and patterns.
Home-page: https://github.com/ionelmc/django-admin-utils
Author: Ionel Cristian Mărieș
Author-email: contact@ionelmc.ro
License: BSD-2-Clause
Project-URL: Changelog, https://github.com/ionelmc/django-admin-utils/blob/master/CHANGELOG.rst
Project-URL: Issue Tracker, https://github.com/ionelmc/django-admin-utils/issues
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Framework :: Django
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: Unix
Classifier: Operating System :: POSIX
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Utilities
Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*
Requires-Dist: Django (>=1.11)

========
Overview
========



Utility code and patterns.

* Free software: BSD 2-Clause License

Installation
============

::

    pip install django-admin-utils

You can also install the in-development version with::

    pip install https://github.com/ionelmc/django-admin-utils/archive/master.zip

Documentation
=============

Terse admin.py
--------------

::

    from django.contrib import admin
    from admin_utils import register, inline

    from .models import MyModel, OtherModel

    @register(MyModel)
    class MyModelAdmin(admin.ModelAdmin):
        inlines = inline(OtherModel),

If you want custom admin sites::

    customsite = admin.AdminSite()

    @register(MyModel, site=customsite)
    class MyModelAdmin(admin.ModelAdmin):
        inlines = inline(OherModel),


Mock admin (mount your views in admin using model wrappers)
-----------------------------------------------------------

Have you ever wanted a page in the admin that appears in the app list but you don't have any
models ? Now you can have that without patching up the admin Site or the templates. Just put this
in your admin.py::

    from django.urls import path
    from admin_utils import make_admin_class

    make_admin_class(
        app_label="test_app",
        model_name="Test1",
        urls=[
            path('', views.root, name='test_app_test1_changelist'),
            path('level1/', views.level1, name='level-1'),
            path('level1/level2/', views.level2, name='level-2'),
        ],
    )

To use different admin site::

    make_admin_class(
        site=customsite,
        app_label="test_app",
        model_name="Test1",
        urls=[
            path('', views.root, name='test_app_test1_changelist'),
            path('level1/', views.level1, name='level-1'),
            path('level1/level2/', views.level2, name='level-2'),
        ],
    )

Alternatively you can mount a single view with a decorator::

    from admin_utils import register_view

    @register_view(
        site=customsite,
        app_label="test_app",
        model_name="Test1",
    )
    def root(request):
        ...


Admin mixins
------------

admin_utils.mixins.FoldableListFilterAdminMixin
```````````````````````````````````````````````

Adds nice filter toggling with cookie support. Largely based on `django-foldable-list-filter
<https://bitbucket.org/Stanislas/django-foldable-list-filter>`_ but without the transition effect and no pictures.

Example::

    from admin_utils.mixins import FoldableListFilterAdminMixin

    class MyModelAdmin(FoldableListFilterAdminMixin, admin.ModelAdmin):
        pass

Looks like this:

    .. image:: https://raw.githubusercontent.com/ionelmc/django-admin-utils/master/docs/FoldableListFilterAdminMixin.png
       :alt: Screenshort of FoldableListFilterAdminMixin

admin_utils.mixins.FullWidthAdminMixin
``````````````````````````````````````

Make the changelist expand instead of having the width of the windows and having that nasty inner scrollbar. You never gonna notice that if
your table is long !

Example::

    from admin_utils.mixins import FoldableListFilterAdminMixin

    class MyModelAdmin(FoldableListFilterAdminMixin, admin.ModelAdmin):
        pass

You probably didn't even notice you had this problem:

.. image:: https://raw.githubusercontent.com/ionelmc/django-admin-utils/master/docs/FullWidthAdminMixin.png
   :alt: Screenshort of FullWidthAdminMixin


Changelog
=========

2.0.1 (2021-07-18)
------------------

* Add missing import for ``admin_utils.register_view``.

2.0.0 (2021-07-18)
------------------

* Drop support for Python 2.7 and Django 1.11.
* Added the ``register_view`` decorator.
* Update examples/readme.
* Various bugfixes.

1.0.0 (2021-07-14)
------------------

* Fixed a bunch of regressions with Django 3.2.

0.3.0 (2014-02-02)
------------------

* Forgot to add any details.


