I did something similar in my project. Here is part of my admin.py

class InvoiceAdmin(admin.ModelAdmin):
        
        def get_urls(self):
                urls = super(InvoiceAdmin, self).get_urls()
                my_urls = patterns('', 
url(r'^admin/invoice/view/(?P<invoice_id>\d+)/$',
self.admin_site.admin_view(self.view_admin_invoice),
name='view_invoice_url'),)
                return my_urls + urls
        
        def view_admin_invoice(self, request, invoice_id):
                # my own view function
        
        def view_invoice(self, obj):
                return mark_safe(' %(link)s Zobraz ') %
dict(link=reverse('admin:view_invoice_url', args=[obj.id]))
        view_invoice.is_safe = True
        view_invoice.allow_tags = True
        
        list_display = ('number', 'view_invoice','status', 'name', 'ico', 
'ic_dph',
'price', 'vat', 'final_price', 'e_bill')
        search_fields = ('ico','e_bill')

admin.site.register(Invoice, InvoiceAdmin)


Maybe it'll point you to the direction u want.

Radovan


Ben-302 wrote:
> 
> Is it possible to mess with the __unicode__ method of a model to
> enable a model instance to return a link to itself when viewed within
> the admin interface? What I want is for there to be a link on an item
> in an inline which takes the user to it's own edit page.
> 
> For example, I have a Survey system where we have questionnaires with
> pages and questions. I use a questions_in_page model to store extra
> attributes for the many_to_many, and this is what appears as an inline
> in the Page admin view (i.e. you can't edit the question itself from
> the Page admin view, only the object in the link table). I'd like to
> be able to create links directly to the questions...
> 
> Any suggestions much appreciated.
> 
> Ben
> 
> -- 
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/hyperlinks-within-admin-interface-tp28634491p28635092.html
Sent from the django-users mailing list archive at Nabble.com.

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

Reply via email to