On Mon, 2008-03-31 at 01:01 -0700, jurian wrote:
> Is there any way apart from the following to get the absolute URL of
> an object?

There is no canonical "absolute URL" for an object. It's one of the
things you define (in the get_absolute_url() method of the model). So
the absolute URL can be anything you want.

It looks, from below, however, as if you're actually wanting a URL for
creating a new model type (which is an object that doesn't exist yet).

> 
> opts = model._meta
> url = "../../../%s/%s/add/" % (opts.app_label.lower(),
> opts.object_name.lower())

You seem to be trying to access the "add" page in the admin interface
for a model of that type. Is that correct? In any case, what you've
written there is a relative URL, so it isn't useful in all situations
(what is it relative to?).

Perhaps you should explain what problem you are trying to solve and we
might be able to help. What are you wanting to with this particular
string you are constructing?

Regards,
Malcolm

-- 
If you think nobody cares, try missing a couple of payments. 
http://www.pointy-stick.com/blog/


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