Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

newforms-admin: Removed some edit_inline stuff and 'oldform' template…

… variable in add_view() and change_view()

git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@4569 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 43829a95d3e5740250794a0b4400fd813e724a2e 1 parent ced8ae1
@adrianholovaty adrianholovaty authored
View
2  django/contrib/admin/options.py
@@ -373,7 +373,6 @@ def add_view(self, request, form_url=''):
c = template.RequestContext(request, {
'title': _('Add %s') % opts.verbose_name,
'adminform': AdminForm(form, self.fieldsets_add(request), self.prepopulated_fields),
- 'oldform': oldforms.FormWrapper(model.AddManipulator(), {}, {}),
'is_popup': request.REQUEST.has_key('_popup'),
'show_delete': False,
'javascript_imports': self.javascript_add(request),
@@ -428,7 +427,6 @@ def change_view(self, request, object_id):
c = template.RequestContext(request, {
'title': _('Change %s') % opts.verbose_name,
'adminform': AdminForm(form, self.fieldsets_change(request, object_id), self.prepopulated_fields),
- 'oldform': oldforms.FormWrapper(model.ChangeManipulator(object_id), {}, {}),
'object_id': object_id,
'original': obj,
'is_popup': request.REQUEST.has_key('_popup'),
View
12 django/contrib/admin/templates/admin/change_form.html
@@ -63,18 +63,6 @@
{% block after_field_sets %}{% endblock %}
-{% if change %}
- {% if ordered_objects %}
- <fieldset class="module"><h2>{% trans "Ordering" %}</h2>
- <div class="form-row{% if oldform.order_.errors %} error{% endif %} ">
- {% if oldform.order_.errors %}{{ oldform.order_.html_error_list }}{% endif %}
- <p><label for="id_order_">{% trans "Order:" %}</label> {{ oldform.order_ }}</p>
- </div></fieldset>
- {% endif %}
-{% endif %}
-
-{% for related_object in inline_related_objects %}{% edit_inline related_object %}{% endfor %}
-
{% block after_related_objects %}{% endblock %}
{% submit_row %}
View
55 django/contrib/admin/templatetags/admin_modify.py
@@ -91,54 +91,6 @@ def __init__(self, field_mapping, fields, index):
for field in self.fields]
self.index = index
-class TabularBoundRelatedObject(BoundRelatedObject):
- def __init__(self, related_object, field_mapping, original):
- super(TabularBoundRelatedObject, self).__init__(related_object, field_mapping, original)
- self.field_wrapper_list = [FieldWrapper(field) for field in self.relation.editable_fields()]
-
- fields = self.relation.editable_fields()
-
- self.form_field_collection_wrappers = [FormFieldCollectionWrapper(field_mapping, fields, i)
- for (i,field_mapping) in self.field_mappings.items() ]
- self.original_row_needed = max([fw.use_raw_id_admin() for fw in self.field_wrapper_list])
- self.show_url = original and hasattr(self.relation.opts, 'get_absolute_url')
-
- def template_name(self):
- return "admin/edit_inline_tabular.html"
-
-class StackedBoundRelatedObject(BoundRelatedObject):
- def __init__(self, related_object, field_mapping, original):
- super(StackedBoundRelatedObject, self).__init__(related_object, field_mapping, original)
- fields = self.relation.editable_fields()
- self.field_mappings.fill()
- self.form_field_collection_wrappers = [FormFieldCollectionWrapper(field_mapping ,fields, i)
- for (i,field_mapping) in self.field_mappings.items()]
- self.show_url = original and hasattr(self.relation.opts, 'get_absolute_url')
-
- def template_name(self):
- return "admin/edit_inline_stacked.html"
-
-class EditInlineNode(template.Node):
- def __init__(self, rel_var):
- self.rel_var = rel_var
-
- def render(self, context):
- relation = template.resolve_variable(self.rel_var, context)
- context.push()
- if relation.field.rel.edit_inline == models.TABULAR:
- bound_related_object_class = TabularBoundRelatedObject
- elif relation.field.rel.edit_inline == models.STACKED:
- bound_related_object_class = StackedBoundRelatedObject
- else:
- bound_related_object_class = relation.field.rel.edit_inline
- original = context.get('original', None)
- bound_related_object = relation.bind(context['oldform'], original, bound_related_object_class)
- context['bound_related_object'] = bound_related_object
- t = loader.get_template(bound_related_object.template_name())
- output = t.render(context)
- context.pop()
- return output
-
def output_all(form_fields):
return ''.join([str(f) for f in form_fields])
output_all = register.simple_tag(output_all)
@@ -149,10 +101,3 @@ def field_widget(parser, token):
raise template.TemplateSyntaxError, "%s takes 1 argument" % bits[0]
return FieldWidgetNode(bits[1])
field_widget = register.tag(field_widget)
-
-def edit_inline(parser, token):
- bits = token.contents.split()
- if len(bits) != 2:
- raise template.TemplateSyntaxError, "%s takes 1 argument" % bits[0]
- return EditInlineNode(bits[1])
-edit_inline = register.tag(edit_inline)
Please sign in to comment.
Something went wrong with that request. Please try again.