Opened 17 years ago
Closed 17 years ago
#6911 closed (duplicate)
edit_inline with multiple ForeignKeys referencing the same Model doesn't work
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Happens with todays svn checkout, full error (when editing a material):
Template error
In template /usr/lib/python2.4/site-packages/django/contrib/admin/templates/admin/change_form.html, error at line 56
Caught an exception while rendering: 'bool' object is not callable
46 {% block after_field_sets %}{% endblock %}
47 {% if change %}
48 {% if ordered_objects %}
49 <fieldset class="module"><h2>{% trans "Ordering" %}</h2>
50 <div class="form-row{% if form.order_.errors %} error{% endif %} ">
51 {% if form.order_.errors %}{{ form.order_.html_error_list }}{% endif %}
52 <p><label for="id_order_">{% trans "Order:" %}</label> {{ form.order_ }}</p>
53 </div></fieldset>
54 {% endif %}
55 {% endif %}
56 {% for related_object in inline_related_objects %}{% edit_inline related_object %}{% endfor %}
57 {% block after_related_objects %}{% endblock %}
58 {% submit_row %}
59 {% if add %}
60 <script type="text/javascript">document.getElementById("{{ first_form_field_id }}").focus();</script>
61 {% endif %}
62 {% if auto_populated_fields %}
63 <script type="text/javascript">
64 {% auto_populated_field_script auto_populated_fields change %}
65 </script>
66 {% endif %}
Short example:
class Material(models.Model):
name = models.TextField()
class MaterialRelation(models.Model):
a = models.ForeignKey(Material,related_name='A', edit_inline=models.TABULAR, num_in_admin=5)
b = models.ForeignKey(Material, related_name='B')
c = models.ForeignKey(Material, blank=True, related_name='C')
def unicode(self):
return self.b.name
Please suggest a work around. As I'm new to django I'd rather not digg into
the code myself.
Thanks!
Duplicate of #1939. This has been fixed in newforms-admin.