well you can do it with a minimal overhead...

copy the django/contrib/admin/templates/change_form.html file to your
project/templates/admin/ folder.
The line with {% submit_row %} is what your are searching for: add
whatever you need.

Unisng the context parameter, pass to render_change_form whatever you
want to find in the change_form template. Remember to use mark_safe()
Then in your model admin.py you can do also some dirty (well I advised
you  they are dirty) hacks like (in my case they works easily because
I know that my app will run in Italian only:

class ABCAdmin(admin.modelAdmin):
        def render_change_form(self, request, context, add=False,
change=False, form_url='', obj=None):
                ret = super(ABCAdmin, self).render_change_form(request, context,
add, change, form_url, obj)
                
                # remove "add another"
                ret.content = ret.content.replace('<input type="submit" 
value="Salva
e aggiungi un altro" name="_addanother"  />', '')
                
                # remove "add and continue"
                ret.content = ret.content.replace('<input type="submit" 
value="Salva
e continua le modifiche" name="_continue" />', '')
                
                # change the save button text to "send"
                ret.content = ret.content.replace('Salva', 'Invia')
                
                # add a link to import data using a csv (the link will point to 
a
url that is mapped to a custom view)
                ret.content = ret.content.replace('Aggiungi messaggio inviato',
'Invia messaggio')
                return ret

On Tue, Jun 1, 2010 at 11:07, gderazon <gdera...@gmail.com> wrote:
> I would like to add my own custom operations in addition to standard
> "save and add another", "save" etc'
> Is it supported?
>
> --
> 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.
>
>

-- 
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