Hi Norbert,

here is a very simple way to achieve this:

1) make a copy of django\contrib\admin\templates\admin\change_form.html
    in your own template: location
mytemplates\admin_copies\change_form.html

2) change it by wrapping submit_row in a block, for example:
   {% block hidesubmit %}{% submit_row %}{% endblock %}

3) create a new change_form.html template in mytemplates\admin\

{% extends "admin_copies/change_form.html" %}
{% load i18n admin_modify adminmedia %}
{% block hidesubmit %}
  {% ifequal user.username 'admin' %}
    {% submit_row %}
  {% else %}
    {% if original.admin %}
      {% for a in original.admin.all %}
        {% ifequal user.username a.username %}
          {% submit_row %}
        {% endifequal %}
      {% endfor %}
    {% else %}
      {% submit_row %}
    {% endif %}
  {% endifequal %}
{% endblock %}

Notes:
- here I have only one administrator named admin. It should be possible
to improve this template to make it more generic.
- this also assume that the model provides an admin field which is a
ManytoMany or ForeignKey to Django User mode. Maybe there is way to
detect which field is related to User model.
- there are two locations where submit_row tag is called, then you will
have to define two different blocks (hidesubmittop and hidesubmitbot
for example) and repeat yourself (oops, no, no, use an include tag
instead)

HTH

Olive.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to