Added more information to index
parent
279ce2e71f
commit
e43d7d67c2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -6,16 +6,52 @@
|
||||||
Welcome to Django Admin Sortable's documentation!
|
Welcome to Django Admin Sortable's documentation!
|
||||||
=================================================
|
=================================================
|
||||||
|
|
||||||
|
Django Admin Sortable is a super-easy way to add drag-and-drop ordering to almost any model you manage through Django admin. Inlines for a sortable model may also be made sortable, enabling individual items or groups of items to be sortable.
|
||||||
|
|
||||||
|
Supported Django Versions
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
Django 1.4.x
|
||||||
|
^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Use django-admin-sortable 1.4.9 or below.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
v1.5.2 introduced backwards incompatible changes for Django 1.4.x
|
||||||
|
|
||||||
|
Django >= 1.5.x
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Use the latest version of django-admin-sortable.
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
|
||||||
|
v1.6.6 introduced a backwards-incompatible change for ``sorting_filters``. Please update your ``sorting_filters`` attribute(s) to the new, tuple-based format.
|
||||||
|
|
||||||
|
What's New in |version|?
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
- Python 2.6 backwards compatibility. Thanks `@EnTeQuAk <https://github.com/EnTeQuAk>`_
|
||||||
|
|
||||||
|
|
||||||
Contents:
|
Contents:
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 2
|
:maxdepth: 2
|
||||||
|
|
||||||
quickstart
|
quickstart
|
||||||
|
configuration
|
||||||
|
usage
|
||||||
|
django-cms
|
||||||
|
known-issues
|
||||||
|
rationale
|
||||||
|
status
|
||||||
|
future
|
||||||
|
license
|
||||||
|
|
||||||
Indices and tables
|
Indices and tables
|
||||||
==================
|
------------------
|
||||||
|
|
||||||
* :ref:`genindex`
|
* :ref:`genindex`
|
||||||
* :ref:`modindex`
|
* :ref:`modindex`
|
||||||
|
|
|
||||||
|
|
@ -8,3 +8,30 @@ To get started using ``django-admin-sortable`` simply install it using ``pip``::
|
||||||
Add ``adminsortable`` to your project's ``INSTALLED_APPS`` setting.
|
Add ``adminsortable`` to your project's ``INSTALLED_APPS`` setting.
|
||||||
|
|
||||||
Ensure ``django.core.context_processors.static`` is in your ``TEMPLATE_CONTEXT_PROCESSORS`` setting.
|
Ensure ``django.core.context_processors.static`` is in your ``TEMPLATE_CONTEXT_PROCESSORS`` setting.
|
||||||
|
|
||||||
|
Define your model, inheriting from ``adminsortable.Sortable``::
|
||||||
|
|
||||||
|
# models.py
|
||||||
|
from adminsortable.models import Sortable
|
||||||
|
|
||||||
|
class MySortableClass(Sortable):
|
||||||
|
class Meta(Sortable.Meta):
|
||||||
|
pass
|
||||||
|
|
||||||
|
title = models.CharField(max_length=50)
|
||||||
|
|
||||||
|
def __unicode__(self):
|
||||||
|
return self.title
|
||||||
|
|
||||||
|
Wire up your sortable model to Django admin::
|
||||||
|
|
||||||
|
# admin.py
|
||||||
|
from adminsortable.admin import SortableAdmin
|
||||||
|
from .models import MySortableClass
|
||||||
|
|
||||||
|
class MySortableAdminClass(SortableAdmin):
|
||||||
|
"""Any admin options you need go here"""
|
||||||
|
|
||||||
|
admin.site.register(MySortableClass, MySortableAdminClass)
|
||||||
|
|
||||||
|
Your model's ChangeList view should now have an extra tool link when there are 2 or more objects present that will take you to a view where you can drag-and-drop the objects into your desired order.
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,161 @@
|
||||||
|
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
|
||||||
|
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
|
<title><no title> — Django Admin Sortable 1.7.0 documentation</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<link rel="top" title="Django Admin Sortable 1.7.0 documentation" href="index.html"/>
|
||||||
|
<link rel="prev" title="Quickstart" href="quickstart.html"/>
|
||||||
|
|
||||||
|
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="wy-body-for-nav" role="document">
|
||||||
|
|
||||||
|
<div class="wy-grid-for-nav">
|
||||||
|
|
||||||
|
|
||||||
|
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||||
|
<div class="wy-side-nav-search">
|
||||||
|
|
||||||
|
<a href="index.html" class="fa fa-home"> Django Admin Sortable</a>
|
||||||
|
|
||||||
|
<div role="search">
|
||||||
|
<form id ="rtd-search-form" class="wy-form" action="search.html" method="get">
|
||||||
|
<input type="text" name="q" placeholder="Search docs" />
|
||||||
|
<input type="hidden" name="check_keywords" value="yes" />
|
||||||
|
<input type="hidden" name="area" value="default" />
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
|
||||||
|
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="quickstart.html">Quickstart</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
|
||||||
|
|
||||||
|
|
||||||
|
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
|
||||||
|
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
|
||||||
|
<a href="index.html">Django Admin Sortable</a>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="wy-nav-content">
|
||||||
|
<div class="rst-content">
|
||||||
|
<div role="navigation" aria-label="breadcrumbs navigation">
|
||||||
|
<ul class="wy-breadcrumbs">
|
||||||
|
<li><a href="index.html">Docs</a> »</li>
|
||||||
|
|
||||||
|
<li><no title></li>
|
||||||
|
<li class="wy-breadcrumbs-aside">
|
||||||
|
|
||||||
|
<a href="_sources/configuration.txt" rel="nofollow"> View page source</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<hr/>
|
||||||
|
</div>
|
||||||
|
<div role="main" class="document">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<footer>
|
||||||
|
|
||||||
|
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
|
||||||
|
|
||||||
|
|
||||||
|
<a href="quickstart.html" class="btn btn-neutral" title="Quickstart"><span class="fa fa-arrow-circle-left"></span> Previous</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<hr/>
|
||||||
|
|
||||||
|
<div role="contentinfo">
|
||||||
|
<p>
|
||||||
|
© Copyright 2014, Brandon Taylor.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<a href="https://github.com/snide/sphinx_rtd_theme">Sphinx theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
var DOCUMENTATION_OPTIONS = {
|
||||||
|
URL_ROOT:'./',
|
||||||
|
VERSION:'1.7.0',
|
||||||
|
COLLAPSE_INDEX:false,
|
||||||
|
FILE_SUFFIX:'.html',
|
||||||
|
HAS_SOURCE: true
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<script type="text/javascript" src="_static/jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="_static/underscore.js"></script>
|
||||||
|
<script type="text/javascript" src="_static/doctools.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script type="text/javascript" src="_static/js/theme.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
jQuery(function () {
|
||||||
|
SphinxRtdTheme.StickyNav.enable();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -96,6 +96,31 @@
|
||||||
|
|
||||||
<div class="section" id="welcome-to-django-admin-sortable-s-documentation">
|
<div class="section" id="welcome-to-django-admin-sortable-s-documentation">
|
||||||
<h1>Welcome to Django Admin Sortable’s documentation!<a class="headerlink" href="#welcome-to-django-admin-sortable-s-documentation" title="Permalink to this headline">¶</a></h1>
|
<h1>Welcome to Django Admin Sortable’s documentation!<a class="headerlink" href="#welcome-to-django-admin-sortable-s-documentation" title="Permalink to this headline">¶</a></h1>
|
||||||
|
<p>Django Admin Sortable is a super-easy way to add drag-and-drop ordering to almost any model you manage through Django admin. Inlines for a sortable model may also be made sortable, enabling individual items or groups of items to be sortable.</p>
|
||||||
|
<div class="section" id="supported-django-versions">
|
||||||
|
<h2>Supported Django Versions<a class="headerlink" href="#supported-django-versions" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<div class="section" id="django-1-4-x">
|
||||||
|
<h3>Django 1.4.x<a class="headerlink" href="#django-1-4-x" title="Permalink to this headline">¶</a></h3>
|
||||||
|
<p>Use django-admin-sortable 1.4.9 or below.</p>
|
||||||
|
<div class="admonition note">
|
||||||
|
<p class="first admonition-title">Note</p>
|
||||||
|
<p class="last">v1.5.2 introduced backwards incompatible changes for Django 1.4.x</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="django-1-5-x">
|
||||||
|
<h3>Django >= 1.5.x<a class="headerlink" href="#django-1-5-x" title="Permalink to this headline">¶</a></h3>
|
||||||
|
<p>Use the latest version of django-admin-sortable.</p>
|
||||||
|
<div class="admonition warning">
|
||||||
|
<p class="first admonition-title">Warning</p>
|
||||||
|
<p class="last">v1.6.6 introduced a backwards-incompatible change for <code class="docutils literal"><span class="pre">sorting_filters</span></code>. Please update your <code class="docutils literal"><span class="pre">sorting_filters</span></code> attribute(s) to the new, tuple-based format.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="what-s-new-in-version">
|
||||||
|
<h2>What’s New in 1.7.0?<a class="headerlink" href="#what-s-new-in-version" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<ul class="simple">
|
||||||
|
<li>Python 2.6 backwards compatibility. Thanks <a class="reference external" href="https://github.com/EnTeQuAk">@EnTeQuAk</a></li>
|
||||||
|
</ul>
|
||||||
<p>Contents:</p>
|
<p>Contents:</p>
|
||||||
<div class="toctree-wrapper compound">
|
<div class="toctree-wrapper compound">
|
||||||
<ul>
|
<ul>
|
||||||
|
|
@ -104,12 +129,13 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="indices-and-tables">
|
<div class="section" id="indices-and-tables">
|
||||||
<h1>Indices and tables<a class="headerlink" href="#indices-and-tables" title="Permalink to this headline">¶</a></h1>
|
<h2>Indices and tables<a class="headerlink" href="#indices-and-tables" title="Permalink to this headline">¶</a></h2>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li><a class="reference internal" href="genindex.html"><em>Index</em></a></li>
|
<li><a class="reference internal" href="genindex.html"><em>Index</em></a></li>
|
||||||
<li><a class="reference internal" href="py-modindex.html"><em>Module Index</em></a></li>
|
<li><a class="reference internal" href="py-modindex.html"><em>Module Index</em></a></li>
|
||||||
<li><a class="reference internal" href="search.html"><em>Search Page</em></a></li>
|
<li><a class="reference internal" href="search.html"><em>Search Page</em></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,32 @@
|
||||||
</div>
|
</div>
|
||||||
<p>Add <code class="docutils literal"><span class="pre">adminsortable</span></code> to your project’s <code class="docutils literal"><span class="pre">INSTALLED_APPS</span></code> setting.</p>
|
<p>Add <code class="docutils literal"><span class="pre">adminsortable</span></code> to your project’s <code class="docutils literal"><span class="pre">INSTALLED_APPS</span></code> setting.</p>
|
||||||
<p>Ensure <code class="docutils literal"><span class="pre">django.core.context_processors.static</span></code> is in your <code class="docutils literal"><span class="pre">TEMPLATE_CONTEXT_PROCESSORS</span></code> setting.</p>
|
<p>Ensure <code class="docutils literal"><span class="pre">django.core.context_processors.static</span></code> is in your <code class="docutils literal"><span class="pre">TEMPLATE_CONTEXT_PROCESSORS</span></code> setting.</p>
|
||||||
|
<p>Define your model, inheriting from <code class="docutils literal"><span class="pre">adminsortable.Sortable</span></code>:</p>
|
||||||
|
<div class="highlight-python"><div class="highlight"><pre><span class="c"># models.py</span>
|
||||||
|
<span class="kn">from</span> <span class="nn">adminsortable.models</span> <span class="kn">import</span> <span class="n">Sortable</span>
|
||||||
|
|
||||||
|
<span class="k">class</span> <span class="nc">MySortableClass</span><span class="p">(</span><span class="n">Sortable</span><span class="p">):</span>
|
||||||
|
<span class="k">class</span> <span class="nc">Meta</span><span class="p">(</span><span class="n">Sortable</span><span class="o">.</span><span class="n">Meta</span><span class="p">):</span>
|
||||||
|
<span class="k">pass</span>
|
||||||
|
|
||||||
|
<span class="n">title</span> <span class="o">=</span> <span class="n">models</span><span class="o">.</span><span class="n">CharField</span><span class="p">(</span><span class="n">max_length</span><span class="o">=</span><span class="mi">50</span><span class="p">)</span>
|
||||||
|
|
||||||
|
<span class="k">def</span> <span class="nf">__unicode__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||||
|
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">title</span>
|
||||||
|
</pre></div>
|
||||||
|
</div>
|
||||||
|
<p>Wire up your sortable model to Django admin:</p>
|
||||||
|
<div class="highlight-python"><div class="highlight"><pre><span class="c"># admin.py</span>
|
||||||
|
<span class="kn">from</span> <span class="nn">adminsortable.admin</span> <span class="kn">import</span> <span class="n">SortableAdmin</span>
|
||||||
|
<span class="kn">from</span> <span class="nn">.models</span> <span class="kn">import</span> <span class="n">MySortableClass</span>
|
||||||
|
|
||||||
|
<span class="k">class</span> <span class="nc">MySortableAdminClass</span><span class="p">(</span><span class="n">SortableAdmin</span><span class="p">):</span>
|
||||||
|
<span class="sd">"""Any admin options you need go here"""</span>
|
||||||
|
|
||||||
|
<span class="n">admin</span><span class="o">.</span><span class="n">site</span><span class="o">.</span><span class="n">register</span><span class="p">(</span><span class="n">MySortableClass</span><span class="p">,</span> <span class="n">MySortableAdminClass</span><span class="p">)</span>
|
||||||
|
</pre></div>
|
||||||
|
</div>
|
||||||
|
<p>Your model’s ChangeList view should now have an extra tool link when there are 2 or more objects present that will take you to a view where you can drag-and-drop the objects into your desired order.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Search.setIndex({envversion:42,terms:{set:1,simpli:1,quickstart:[],modul:0,pip:1,"static":1,ensur:1,instal:1,installed_app:1,your:1,index:0,content:0,start:1,add:1,adminsort:1,core:1,get:1,context_processor:1,search:0,template_context_processor:1,project:1,page:0},objtypes:{},objnames:{},filenames:["index","quickstart"],titles:["Welcome to Django Admin Sortable’s documentation!","Quickstart"],objects:{},titleterms:{sortabl:0,welcom:0,admin:0,indic:0,django:0,tabl:0,document:0,quickstart:1}})
|
Search.setIndex({envversion:42,terms:{through:0,group:0,thank:0,easi:0,should:2,add:[0,2],adminsort:2,introduc:0,"return":2,get:2,python:0,context_processor:2,"import":2,now:2,tbd:[],template_context_processor:2,enabl:0,drop:[0,2],item:0,where:2,page:0,view:2,pleas:0,set:2,sortableadmin:2,individu:0,meta:2,"static":2,pass:2,compat:0,index:0,wire:2,content:0,"new":[],attribut:0,core:2,here:2,base:0,"super":0,"__unicode__":2,search:0,manag:0,charfield:2,chang:0,simpli:2,extra:2,modul:0,ensur:2,instal:2,installed_app:2,your:[0,2],from:2,wai:0,regist:2,start:2,max_length:2,more:2,desir:2,option:2,tupl:0,tool:2,site:2,link:2,entequak:0,inlin:0,present:2,made:0,project:2,defin:2,below:0,can:2,def:2,quickstart:[],almost:0,changelist:2,ani:[0,2],need:2,have:2,pip:2,mysortableadminclass:2,incompat:0,mysortableclass:2,titl:2,self:2,format:0,when:2,also:0,take:2,you:[0,2],updat:0,sorting_filt:0,object:2,drag:[0,2],mai:0,"class":2,inherit:2,model:[0,2],backward:0,order:[0,2],latest:0},objtypes:{},objnames:{},filenames:["index","configuration","quickstart"],titles:["Welcome to Django Admin Sortable’s documentation!","<no title>","Quickstart"],objects:{},titleterms:{what:0,sortabl:0,welcom:0,quickstart:2,admin:0,support:0,indic:0,django:0,version:0,tabl:0,"new":0,document:0,higher:[]}})
|
||||||
|
|
@ -6,16 +6,52 @@
|
||||||
Welcome to Django Admin Sortable's documentation!
|
Welcome to Django Admin Sortable's documentation!
|
||||||
=================================================
|
=================================================
|
||||||
|
|
||||||
|
Django Admin Sortable is a super-easy way to add drag-and-drop ordering to almost any model you manage through Django admin. Inlines for a sortable model may also be made sortable, enabling individual items or groups of items to be sortable.
|
||||||
|
|
||||||
|
Supported Django Versions
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
Django 1.4.x
|
||||||
|
^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Use django-admin-sortable 1.4.9 or below.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
v1.5.2 introduced backwards incompatible changes for Django 1.4.x
|
||||||
|
|
||||||
|
Django >= 1.5.x
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Use the latest version of django-admin-sortable.
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
|
||||||
|
v1.6.6 introduced a backwards-incompatible change for ``sorting_filters``. Please update your ``sorting_filters`` attribute(s) to the new, tuple-based format.
|
||||||
|
|
||||||
|
What's New in |version|?
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
- Python 2.6 backwards compatibility. Thanks `@EnTeQuAk <https://github.com/EnTeQuAk>`_
|
||||||
|
|
||||||
|
|
||||||
Contents:
|
Contents:
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 2
|
:maxdepth: 2
|
||||||
|
|
||||||
quickstart
|
quickstart
|
||||||
|
configuration
|
||||||
|
usage
|
||||||
|
django-cms
|
||||||
|
known-issues
|
||||||
|
rationale
|
||||||
|
status
|
||||||
|
future
|
||||||
|
license
|
||||||
|
|
||||||
Indices and tables
|
Indices and tables
|
||||||
==================
|
------------------
|
||||||
|
|
||||||
* :ref:`genindex`
|
* :ref:`genindex`
|
||||||
* :ref:`modindex`
|
* :ref:`modindex`
|
||||||
|
|
|
||||||
|
|
@ -8,3 +8,30 @@ To get started using ``django-admin-sortable`` simply install it using ``pip``::
|
||||||
Add ``adminsortable`` to your project's ``INSTALLED_APPS`` setting.
|
Add ``adminsortable`` to your project's ``INSTALLED_APPS`` setting.
|
||||||
|
|
||||||
Ensure ``django.core.context_processors.static`` is in your ``TEMPLATE_CONTEXT_PROCESSORS`` setting.
|
Ensure ``django.core.context_processors.static`` is in your ``TEMPLATE_CONTEXT_PROCESSORS`` setting.
|
||||||
|
|
||||||
|
Define your model, inheriting from ``adminsortable.Sortable``::
|
||||||
|
|
||||||
|
# models.py
|
||||||
|
from adminsortable.models import Sortable
|
||||||
|
|
||||||
|
class MySortableClass(Sortable):
|
||||||
|
class Meta(Sortable.Meta):
|
||||||
|
pass
|
||||||
|
|
||||||
|
title = models.CharField(max_length=50)
|
||||||
|
|
||||||
|
def __unicode__(self):
|
||||||
|
return self.title
|
||||||
|
|
||||||
|
Wire up your sortable model to Django admin::
|
||||||
|
|
||||||
|
# admin.py
|
||||||
|
from adminsortable.admin import SortableAdmin
|
||||||
|
from .models import MySortableClass
|
||||||
|
|
||||||
|
class MySortableAdminClass(SortableAdmin):
|
||||||
|
"""Any admin options you need go here"""
|
||||||
|
|
||||||
|
admin.site.register(MySortableClass, MySortableAdminClass)
|
||||||
|
|
||||||
|
Your model's ChangeList view should now have an extra tool link when there are 2 or more objects present that will take you to a view where you can drag-and-drop the objects into your desired order.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue