Thursday, July 4, 2013

Re: Call action with a link in the admin site

Hola Juan Antonio,

Es totalmente posible.

Puedes ver un ejemplo en alguno de mis proyectos: https://github.com/jelukas/presupy/blob/master/presu/admin.py#L39-L47

Un saludo


2013/7/4 Juan Antonio García Cano <juang14.88@gmail.com>

In the admin.py i have this function:

  actions = ['generar_pdf']    def generar_pdf(self, request, queryset):

... (This function make a PDF of the object selected)

And i show one button in the list_display (of the admin site) with this function:

  def boton_mail(self,obj):                  return mark_safe('<center><img src="http://mypage/static/admin/img/descargar_pdf.png" alt="Descargar PDF" width=30 height=25></center>')

It is posible to call the function "generar_pdf" with a link (< a >) in the function "boton_mail"?

(I want to call the action from a image in the list display in the admin site)

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
-----------------------------------------------------------------------------------------------------------------

Jesús Lucas Flores
Administrador de Sistemas y Programador Web
Twitter:     @jelukas89

-----------------------------------------------------------------------------------------------------------------

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate