Summary:

In Django 1.2.3 within the changeform.html the variable
context["adminform"].model_admin --> {{adminform.model_admin}}  is not
accesible

Longer description:

On an admin form (changeform.html) I would like to generate a toolbar,
which should show (for the moment) the same actions as the ones shown
on the changelist.

In order to achieve this I need access to the model admin of the
entry.

When I stop in options.py in the function render_change_form(). I
check the variable context and I find:

>>> context["adminform"].model_admin.actions
['say_hello']

Okay, at this very moment the context includes my desired value. But
it seems in the template (changeform.html) this variables does not
exist anymore.

This is the snippet inserted in changeform.html:

<h1>before</h1>

<b>adminform (exists):</b> {{ adminform }}<br/><br/>
<b>adminform.form (exists):</b> {{ adminform.form }}<br/><br/>
<b>adminform.model_admin (does not exists):</b>
{{ adminform.model_admin }}<br/><br/>
<b>adminform.model_admin.actions (does not exists):</b>
{{ adminform.model_admin.actions }}<br/><br/>
<br/>
{% for action in adminform.model_admin.actions %}
  {{ action }}
{% endfor %}

<h1>after</h1>

And this is the result:

before
adminform (exists): <django.contrib.admin.helpers.AdminForm object at
0x04E4D830>

adminform.form (exists): Active:   Active
1 = active employee, 0 = inactive employee Employee's abreviation:
SOME
Employee's abbreviation. Eg. ASM, PIF, KUF, ... Name: Some Name
Employee name. Eg.: Marco Aschwanden, ... Phone:+44 44 4444 444 44
Employee's phone number. E-Mail:some.n...@lame.ch

adminform.model_admin (does not exists): UUUPPPPS!

adminform.model_admin.actions (does not exists): UUUPPPPS!
after

What happend to model_admin? How do I get access to the model_admin
within the changeform.html? I need access to the properties of the
model_admin (ModelAdmin).

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to