Skip to content

Commit

Permalink
Fixed #19469 -- Removed opts.get_ordered_objects() and related code
Browse files Browse the repository at this point in the history
The code was dead-code since 2006.
  • Loading branch information
akaariai committed Dec 16, 2012
1 parent 9facca2 commit d7b49f5
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 328 deletions.
4 changes: 0 additions & 4 deletions django/contrib/admin/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,6 @@ def media(self):
js.append('actions%s.js' % extra)
if self.prepopulated_fields:
js.extend(['urlify.js', 'prepopulate%s.js' % extra])
if self.opts.get_ordered_objects():
js.extend(['getElementsBySelector.js', 'dom-drag.js' , 'admin/ordering.js'])
return forms.Media(js=[static('admin/js/%s' % url) for url in js])

def get_model_perms(self, request):
Expand Down Expand Up @@ -764,7 +762,6 @@ def save_related(self, request, form, formsets, change):
def render_change_form(self, request, context, add=False, change=False, form_url='', obj=None):
opts = self.model._meta
app_label = opts.app_label
ordered_objects = opts.get_ordered_objects()
context.update({
'add': add,
'change': change,
Expand All @@ -773,7 +770,6 @@ def render_change_form(self, request, context, add=False, change=False, form_url
'has_delete_permission': self.has_delete_permission(request, obj),
'has_file_field': True, # FIXME - this should check if form or formsets have a FileField,
'has_absolute_url': hasattr(self.model, 'get_absolute_url'),
'ordered_objects': ordered_objects,
'form_url': form_url,
'opts': opts,
'content_type_id': ContentType.objects.get_for_model(self.model).id,
Expand Down
137 changes: 0 additions & 137 deletions django/contrib/admin/static/admin/js/admin/ordering.js

This file was deleted.

167 changes: 0 additions & 167 deletions django/contrib/admin/static/admin/js/getElementsBySelector.js

This file was deleted.

2 changes: 1 addition & 1 deletion django/contrib/admin/templates/admin/change_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}" />{% endblock %}

{% block coltype %}{% if ordered_objects %}colMS{% else %}colM{% endif %}{% endblock %}
{% block coltype %}colM{% endblock %}

{% block bodyclass %}{{ opts.app_label }}-{{ opts.object_name.lower }} change-form{% endblock %}

Expand Down
8 changes: 4 additions & 4 deletions django/contrib/admin/templates/admin/submit_line.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{% load i18n admin_urls %}
<div class="submit-row">
{% if show_save %}<input type="submit" value="{% trans 'Save' %}" class="default" name="_save" {{ onclick_attrib }}/>{% endif %}
{% if show_save %}<input type="submit" value="{% trans 'Save' %}" class="default" name="_save" />{% endif %}
{% if show_delete_link %}<p class="deletelink-box"><a href="{% url opts|admin_urlname:'delete' original.pk|admin_urlquote %}" class="deletelink">{% trans "Delete" %}</a></p>{% endif %}
{% if show_save_as_new %}<input type="submit" value="{% trans 'Save as new' %}" name="_saveasnew" {{ onclick_attrib }}/>{%endif%}
{% if show_save_and_add_another %}<input type="submit" value="{% trans 'Save and add another' %}" name="_addanother" {{ onclick_attrib }}/>{% endif %}
{% if show_save_and_continue %}<input type="submit" value="{% trans 'Save and continue editing' %}" name="_continue" {{ onclick_attrib }}/>{% endif %}
{% if show_save_as_new %}<input type="submit" value="{% trans 'Save as new' %}" name="_saveasnew" />{%endif%}
{% if show_save_and_add_another %}<input type="submit" value="{% trans 'Save and add another' %}" name="_addanother" />{% endif %}
{% if show_save_and_continue %}<input type="submit" value="{% trans 'Save and continue editing' %}" name="_continue" />{% endif %}
</div>
2 changes: 0 additions & 2 deletions django/contrib/admin/templatetags/admin_modify.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ def submit_row(context):
save_as = context['save_as']
ctx = {
'opts': opts,
'onclick_attrib': (opts.get_ordered_objects() and change
and 'onclick="submitOrderForm();"' or ''),
'show_delete_link': (not is_popup and context['has_delete_permission']
and change and context.get('show_delete', True)),
'show_save_as_new': not is_popup and change and save_as,
Expand Down
13 changes: 0 additions & 13 deletions django/db/models/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,16 +507,3 @@ def get_ancestor_link(self, ancestor):
# of the chain to the ancestor is that parent
# links
return self.parents[parent] or parent_link

def get_ordered_objects(self):
"Returns a list of Options objects that are ordered with respect to this object."
if not hasattr(self, '_ordered_objects'):
objects = []
# TODO
#for klass in get_models(get_app(self.app_label)):
# opts = klass._meta
# if opts.order_with_respect_to and opts.order_with_respect_to.rel \
# and self == opts.order_with_respect_to.rel.to._meta:
# objects.append(opts)
self._ordered_objects = objects
return self._ordered_objects

0 comments on commit d7b49f5

Please sign in to comment.