I don't understand the documentation.  I am able to get the "view on
site" link to show, but the URL is wrong.  The correct URL for the
instance is...

http://www.mysite.com/billing/321

...so I tried this...

    def get_absolute_url(self):
        return "/billing/%i" % self.id

...but when I click the resulting "view on site" link, I'm redirected
to...

http://example.com/billing/321/

I'm not sure where that "example.com" is coming from.  I went looking
for it in settings.py and urls.py and don't see it anywhere.

-Ryan





On Nov 4, 11:25 am, Adi Jörg Sieker <[EMAIL PROTECTED]> wrote:
> On 04.11.2008 17:19 Uhr,webcommwrote:> How do I get the instance id from 
> within an admin template?  I want to
> > add a link to view the instance, and I need the id to create that
> > link.  Like so...
>
> > <a href="/my_page/{{ get_the_id_somehow }}">View this item</a>
>
> if your Model supplies a get_absolute_url method, then the Admin will
> automatically create a "view on site" link
> on the change detail page.
> See 
> alsohttp://docs.djangoproject.com/en/dev/ref/models/instances/#get-absolu...
>
> adi
>
> --
> Adi J. Sieker         mobile: +49 - 178 - 88 5 88 13
> Freelance developer   web:    http://www.sieker.info/profile
> SAP-Developer
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to