Ticket #7469: relation_link.diff

File relation_link.diff, 1.8 KB (added by Reto Aebersold, 16 years ago)
  • django/contrib/admin/views/main.py

     
    140140            self.related_url = mark_safe(u'../../../%s/%s/'
    141141                    % (field.rel.to._meta.app_label,
    142142                        field.rel.to._meta.object_name.lower()))
     143       
     144        if field.rel and isinstance(field.rel, models.ManyToOneRel):
     145            self.fk_id = self.original.__dict__[self.field.attname]
    143146
    144147    def original_value(self):
    145148        if self.original:
  • django/contrib/admin/templates/widget/foreign.html

     
    88    {% endif %}
    99{% else %}
    1010{% if bound_field.needs_add_label %}
    11     <a href="{{ bound_field.related_url }}add/" class="add-another" id="add_{{ bound_field.element_id }}" onclick="return showAddAnotherPopup(this);"> <img src="{% admin_media_prefix %}img/admin/icon_addlink.gif" width="10" height="10" alt="Add Another"/></a>
     11    <a href="{{ bound_field.related_url }}add/" class="add-another" id="add_{{ bound_field.element_id }}" onclick="return showAddAnotherPopup(this);"> <img src="{% admin_media_prefix %}img/admin/icon_addlink.gif" width="10" height="10" alt="Add Another"/></a> {%if bound_field.fk_id %}<a href="{{ bound_field.related_url }}{{ bound_field.fk_id }}/" title="Go to selected model"><img src="{% admin_media_prefix %}img/admin/selector-addall.gif" width="16" height="16" alt="Go to selected model"/></a>{% endif %}
    1212{% endif %}{% endif %}
    1313{% if change %}
    1414    {% if bound_field.field.primary_key %}
Back to Top