django-admin2/README.rst

152 lines
3.9 KiB
ReStructuredText
Raw Normal View History

2013-05-14 12:12:32 +00:00
===============
django-admin2
===============
.. image:: https://travis-ci.org/pydanny/django-admin2.png
:alt: Build Status
:target: https://travis-ci.org/pydanny/django-admin2
.. image:: https://coveralls.io/repos/pydanny/django-admin2/badge.png?branch=develop
:alt: Coverage Status
:target: https://coveralls.io/r/pydanny/django-admin2
2013-07-07 06:44:59 +00:00
.. image:: https://pypip.in/v/django-admin2/badge.png
:target: https://crate.io/packages/django-admin2/
.. image:: https://pypip.in/d/django-admin2/badge.png
:target: https://crate.io/packages/django-admin2/
2013-07-06 14:33:59 +00:00
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.
2013-07-14 09:54:57 +00:00
Full Documentation at: http://django-admin2.rtfd.org/
2013-05-18 06:44:31 +00:00
2013-07-05 14:48:46 +00:00
Features
=============
2013-07-05 14:48:35 +00:00
* Rewrite of the Django Admin backend
* Drop-in themes
* Built-in RESTful API
Screenshots
===========
.. image:: https://github.com/pydanny/django-admin2/raw/develop/screenshots/Site_administration.png
:width: 722px
:alt: Site administration
:align: center
:target: https://github.com/pydanny/django-admin2/raw/develop/screenshots/Site_administration.png
.. image:: https://github.com/pydanny/django-admin2/raw/develop/screenshots/Select_user.png
:width: 722px
:alt: Select user
:align: center
:target: https://github.com/pydanny/django-admin2/raw/develop/screenshots/Select_user.png
2013-05-18 06:44:31 +00:00
2013-05-19 08:17:45 +00:00
Requirements
=============
* Django 1.5+
2013-05-31 08:21:02 +00:00
* Python 2.7+ or Python 3.3+
2013-06-18 11:46:17 +00:00
* django-braces_
* django-extra-views_
* django-floppyforms_
* django-rest-framework_
2013-07-14 09:21:30 +00:00
* django-filter_
2013-06-18 11:46:17 +00:00
* Sphinx_ (for documentation)
.. _django-braces: https://github.com/brack3t/django-braces
.. _django-extra-views: https://github.com/AndrewIngram/django-extra-views
.. _django-floppyforms: https://github.com/brutasse/django-floppyforms
.. _django-rest-framework: https://github.com/tomchristie/django-rest-framework
2013-07-14 09:21:30 +00:00
.. _django-filter: https://github.com/alex/django-filter
2013-06-18 11:46:17 +00:00
.. _Sphinx: http://sphinx-doc.org/
2013-05-18 06:44:31 +00:00
2013-07-05 20:59:46 +00:00
Installation
============
2013-07-05 20:59:46 +00:00
Use pip to install from PyPI:
.. code-block:: python
pip install django-admin2
2013-07-06 00:06:07 +00:00
Add djadmin2 and rest_framework to your settings file:
2013-07-05 20:59:46 +00:00
.. code-block:: python
2013-07-07 14:45:12 +00:00
INSTALLED_APPS = (
...
'djadmin2',
'rest_framework', # for the browsable API templates
'floppyforms', # For HTML5 form fields
'crispy_forms', # Required for the default theme's layout
...
)
2013-07-05 20:59:46 +00:00
Add djadmin2 urls to your URLconf:
.. code-block:: python
# urls.py
from django.conf.urls import patterns, include
2013-07-06 13:18:01 +00:00
2013-07-05 20:59:46 +00:00
import djadmin2
2013-07-06 13:18:01 +00:00
2013-07-05 20:59:46 +00:00
djadmin2.default.autodiscover()
urlpatterns = patterns(
...
url(r'^admin2/', include(djadmin2.default.urls)),
)
2013-07-05 14:53:04 +00:00
How to write django-admin2 modules
=====================================
2013-05-14 12:12:32 +00:00
.. code-block:: python
2013-05-14 12:12:32 +00:00
# myapp/admin2.py
# Import your custom models
from django.contrib.auth.forms import UserCreationForm, UserChangeForm
from django.contrib.auth.models import User
2013-05-14 12:12:32 +00:00
2013-06-30 09:38:39 +00:00
from .models import Post, Comment
import djadmin2
2013-05-14 12:12:32 +00:00
class UserAdmin2(djadmin2.ModelAdmin2):
2013-07-05 14:48:35 +00:00
# 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.default.register(Post)
djadmin2.default.register(Comment)
djadmin2.default.register(User, UserAdmin2)
2013-05-17 10:38:39 +00:00
2013-07-05 14:48:35 +00:00
Drop-In Themes
===============
The default theme is whatever bootstrap is most current. Specifically:
.. code-block:: python
2013-07-05 14:53:04 +00:00
# settings.py
ADMIN2_THEME_DIRECTORY = "djadmin2theme_default/"
2013-07-05 14:53:04 +00:00
If you create a new theme, you define it thus:
.. code-block:: python
2013-07-05 14:53:04 +00:00
# settings.py
2013-07-06 13:18:01 +00:00
ADMIN2_THEME_DIRECTORY = "djadmin2/foundation/"