Reverted changes that added get_sort_url template tag, as this caused an exception error with inlines.
parent
661f417a7b
commit
373197553e
|
|
@ -162,8 +162,8 @@ ordering on top of that just seemed a little much in my opinion.
|
|||
django-admin-sortable is currently used in production.
|
||||
|
||||
|
||||
### What's new in 1.4.2?
|
||||
- Unicode support for the sort view title (thanks @knyazz)
|
||||
### What's new in 1.4.3?
|
||||
- Reverted changes that broke getting the sorting url for inlines
|
||||
|
||||
|
||||
### Future
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
VERSION = (1, 4, 2) # following PEP 386
|
||||
VERSION = (1, 4, 3) # following PEP 386
|
||||
DEV_N = None
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -72,11 +72,11 @@ class SortableAdmin(ModelAdmin):
|
|||
# this view changes the order
|
||||
url(r'^sorting/do-sorting/(?P<model_type_id>\d+)/$',
|
||||
self.admin_site.admin_view(self.do_sorting_view),
|
||||
name='{0}_do_sorting'.format(self.model._meta.app_label)),
|
||||
name='admin_do_sorting'),
|
||||
|
||||
# this view shows a link to the drag-and-drop view
|
||||
url(r'^sort/$', self.admin_site.admin_view(self.sort_view),
|
||||
name='{0}_sort'.format(self.model._meta.app_label)),
|
||||
name='admin_sort'),
|
||||
)
|
||||
return admin_urls + urls
|
||||
|
||||
|
|
@ -142,7 +142,7 @@ class SortableAdmin(ModelAdmin):
|
|||
verbose_name_plural = opts.verbose_name_plural
|
||||
|
||||
context = {
|
||||
'title': u'Drag and drop {0} to change display order'.format(
|
||||
'title': 'Drag and drop {0} to change display order'.format(
|
||||
capfirst(verbose_name_plural)),
|
||||
'opts': opts,
|
||||
'app_label': opts.app_label,
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
{% if inline_admin_form.has_auto_field %}{{ inline_admin_form.pk_field.field }}{% endif %}
|
||||
{{ inline_admin_form.fk_field.field }}
|
||||
{% if inline_admin_form.original %}
|
||||
<input type="hidden" name="admin_sorting_url" value="{% get_do_sorting_url inline_admin_form.original %}" />
|
||||
<input type="hidden" name="admin_sorting_url" value="{% url admin:admin_do_sorting inline_admin_form.original.model_type_id %}" />
|
||||
{% endif %}
|
||||
</div>{% endfor %}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
{% endfor %}
|
||||
{% endspaceless %}
|
||||
{% if inline_admin_form.original %}
|
||||
<input type="hidden" name="admin_sorting_url" value="{% get_do_sorting_url inline_admin_form.original %}" />
|
||||
<input type="hidden" name="admin_sorting_url" value="{% url admin:admin_do_sorting inline_admin_form.original.model_type_id %}" />
|
||||
{% endif %}
|
||||
</td>
|
||||
{% for fieldset in inline_admin_form %}
|
||||
|
|
|
|||
|
|
@ -3,4 +3,4 @@
|
|||
<form>
|
||||
<input name="pk" type="hidden" value="{{ object.pk }}" />
|
||||
</form>
|
||||
<a href="{% get_do_sorting_url object %}" class="admin_sorting_url">{{ object }}</a>
|
||||
<a href="{% url admin:admin_do_sorting object.model_type_id %}" class="admin_sorting_url">{{ object }}</a>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
from django import template
|
||||
from django import VERSION as DJANGO_VERSION
|
||||
from django.core.urlresolvers import reverse
|
||||
|
||||
register = template.Library()
|
||||
|
||||
|
|
@ -35,9 +33,3 @@ def render_object_rep(context, obj,
|
|||
context.update({'object': obj})
|
||||
tmpl = template.loader.get_template(sortable_object_rep_template)
|
||||
return tmpl.render(context)
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=False)
|
||||
def get_do_sorting_url(obj):
|
||||
return reverse('admin:{0}_do_sorting'.format(obj._meta.app_label),
|
||||
kwargs={'model_type_id': obj.model_type_id()})
|
||||
|
|
|
|||
Loading…
Reference in New Issue