customizing django admin ChangeForm template / adding custom content
<p>I'm able to insert (lame) static text onto the change form admin page, but I'd really like it to use the context of the current object being edited! </p>

<p>For instance, I want to format on the MyObject change form a URL to include the ID from a ForeignKey connected object (<code>obj</code>) as a link.</p>

<p>My admin objects:</p>

<pre><code>class MyObjectChangeForm(forms.ModelForm):
    class Meta:
        model = MyObject
        fields = ('field1', 'obj',)

class MyObjectAdmin(admin.ModelAdmin):
    form = MyObjectChangeForm
    list_display = ('field1', 'obj')
    def render_change_form(self, request, context, *args, **kwargs):
        self.change_form_template = 'admin/my_change_form.html'
        extra = {'lame_static_text': "something static",}
        context.update(extra)
        return super(MyObjectAdmin, self).render_change_form(request,
            context, *args, **kwargs)
</code></pre>

<p>My template <code>templates/admin/my_change_form.html</code>:</p>

<pre><code>{% extends "admin/change_form.html" %}

{% block form_top %}
    {{ lame_static_text }}
    &lt;a href="http://example.com/abc/{{ adminform.data.obj.id }}?"/&gt;View Website&lt;/a&gt;
{% endblock %}
</code></pre>

<p>The <code>{{adminform.data.obj.id}}</code> call obviously doesn't work, but I'd like something along those lines. </p>

<p>How do I insert dynamic context from the current object into the admin change form?</p>