Issue with relational /absolute {{url}} call

2012-02-24 Thread Eli_West
Ive ran into an issue calling: {{ modelxx.objectyy.url }} Before some recent edits, that call gave a relative path and I used: /site_media/{{ modelxx.objectyy.url }} to get a full file path. After some site changes the .url gives a full path and a double prefix of : /home/trak/media/home/trak/

Re: absolute url in template and url name

2010-11-29 Thread Jumpfroggy
As a followup, I had to do something similar and ended up using this: # Gets the http://domain.com without the trailing / base_url = request.build_absolute_uri('/')[:-1] And in the template I can do this: ... The benefits: -You only have to create the base_url in the view, the rest

Re: absolute url in template and url name

2010-11-24 Thread ryan west
ed on on templates. I have no > idea how to put absolute url to my template (for > examplehttp://domain.com/account/activate/2). I have special url for this, > named account_activation. > I know how to pass variables but how to create that url? > Shouls I use {{ url }} tag? It cr

Re: absolute url in template and url name

2010-11-24 Thread Jumpfroggy
I always do something like this: abs_activate_url = request.build_absolute_uri(reverse('account_activate', args=user.id)) That's an absolute URL, so it's like "http://domain.com/account/ activate/2" instead of the normal reverse() or {% url %} which gives

Re: absolute url in template and url name

2010-11-24 Thread Jason Mayfield
On Nov 24, 2010, at 9:08 AM, robos85 wrote: > What do You mean "current Site object"? from django.contrib.sites.models import Site current_site = Site.objects.get_current() email_vars = Context({'registration_hash' : '123456', 'new_email' : 'm...@mail.com',

Re: absolute url in template and url name

2010-11-24 Thread robos85
current Site object"? On 24 Lis, 14:34, Jason Mayfield wrote: > Pass the current Site object into the template as part of the context.  Then > you can do:  {{ current_site.domain }}{% url account_activation %} for the > absolute url. > > On Nov 24, 2010, at 8:16 AM, rob

Re: absolute url in template and url name

2010-11-24 Thread Jason Mayfield
Pass the current Site object into the template as part of the context. Then you can do: {{ current_site.domain }}{% url account_activation %} for the absolute url. On Nov 24, 2010, at 8:16 AM, robos85 wrote: > small correction not {{ url }} but {% url %} ? > > On 24 Lis, 14:01

Re: absolute url in template and url name

2010-11-24 Thread robos85
small correction not {{ url }} but {% url %} ? On 24 Lis, 14:01, robos85 wrote: > Hi, > I'm writing an email sending module based on on templates. I have no > idea how to put absolute url to my template (for > examplehttp://domain.com/account/activate/2). I have special url

absolute url in template and url name

2010-11-24 Thread robos85
Hi, I'm writing an email sending module based on on templates. I have no idea how to put absolute url to my template (for example http://domain.com/account/activate/2). I have special url for this, named account_activation. I know how to pass variables but how to create that url? Shouls

Re: Absolute URL

2009-03-23 Thread Rajesh D
On Mar 23, 10:20 am, Bro wrote: > Hi, > > django.template.defaultags exist ? Sorry about that. I should've typed: django.template.defaulttags --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group

Re: Absolute URL

2009-03-23 Thread Bro
Hi, django.template.defaultags exist ? On 20 mar, 16:36, Rajesh D wrote: > On Mar 20, 6:16 am, Alfonso wrote: > > > > > Hi, > > > Insanely simple answer here I think but I'm trying to sort someurl > > errors in a mapping app.  Virtual earth requires an absoluteurlto > > the KML file django is

Re: Absolute URL

2009-03-20 Thread Rajesh D
On Mar 20, 6:16 am, Alfonso wrote: > Hi, > > Insanely simple answer here I think but I'm trying to sort some url > errors in a mapping app.  Virtual earth requires an absolute url to > the KML file django is generating for me and I can't seem to work out > how t

Absolute URL

2009-03-20 Thread Alfonso
Hi, Insanely simple answer here I think but I'm trying to sort some url errors in a mapping app. Virtual earth requires an absolute url to the KML file django is generating for me and I can't seem to work out how to define that in the urls.py. of course I can just prepend the site r

Re: Absolute URL vs Relative URL, or ~ ?

2008-09-16 Thread Kip Parker
On Sep 16, 5:42 pm, Dana <[EMAIL PROTECTED]> wrote: > Kip, don't you mean {{ model.get_image_url }}? > get_FOO_url() has gone in Django 1.0. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To po

Re: Absolute URL vs Relative URL, or ~ ?

2008-09-16 Thread Dana
Kip, don't you mean {{ model.get_image_url }}? Using {% url %}, get_absolute_url, MEDIA_ROOT, sites framework and url.py should be able to accomplish what you are looking to do and more. Also look into the permalink decorator while you're at it. Good luck! On Sep 16, 8:27 am, Kip Parker <[EMAIL

Re: Absolute URL vs Relative URL, or ~ ?

2008-09-16 Thread Kip Parker
No, nothing to do with HTTP_HOST, that comes from the server. The point of the sites framework is to differentiate between different sites, so a * site would be pointless. If I were you I'd sort out my templates so that instead of /some/media/location/css/styles.css you have {{MEDIA_URL}}/css/st

Re: Absolute URL vs Relative URL, or ~ ?

2008-09-16 Thread est
Thank you Kip. Call me stupid but does site framework have something to do with HTTP HOST header? But in my case the site is for ANYSITE, no matter you visit the site by IP, domain, or even customized CNAME you cann visit the site with out any problem (Why there isn't a wildcard * in site framew

Re: Absolute URL vs Relative URL, or ~ ?

2008-09-16 Thread Kip Parker
> no, it's not THAT simple. It really is that simple, honest, but your brain has made it all complicated. Look at http://docs.djangoproject.com/en/dev/ref/contrib/sites/ (sites framework), TEMPLATE_CONTEXT_PROCESSORS setting and RequestContext and the URL dispatcher docs, the answers to your pro

Re: Absolute URL vs Relative URL, or ~ ?

2008-09-16 Thread ekellner
On Tue, Sep 16, 2008 at 10:02 AM, est <[EMAIL PROTECTED]> wrote: > > Today, my boss came to me and asked: "Please move our django site from > http://xxx.com/ to http://xxx.com/v2/"; > > It's killing me. Just image how huge mount of HTML source code to > modify. > I STRONGLY suggest django implem

Re: Absolute URL vs Relative URL, or ~ ?

2008-09-16 Thread David Reynolds
On 16 Sep 2008, at 9:53 am, Donn wrote: > How about > 1. making a link under /var/www/assets to /whatever/v2/assets > 2. move your assets directory into /whatever/v2/ > 3. setup your webserver to go look at /var/www/assets when media is > served. > > You should be able to arrange something lik

Re: Absolute URL vs Relative URL, or ~ ?

2008-09-16 Thread Donn
On Tuesday, 16 September 2008 10:32:54 est wrote: > http://xxx.com/assets/main.css > Now the problem is, how can I massively move all template under a new > sub-directory URL like http://xxx.com/v2/ ? How about 1. making a link under /var/www/assets to /whatever/v2/assets 2. move your assets dire

Re: Absolute URL vs Relative URL, or ~ ?

2008-09-16 Thread est
y root (/) is not domain dependent (use sites   > framework for settings domain name). > > -- > We read Knuth so you don't have to. - Tim Peters > > Jarek Zgoda, R&D, Redefine > [EMAIL PROTECTED] Hide quoted text - > > - Show quoted text - no, it's not T

Re: Absolute URL vs Relative URL, or ~ ?

2008-09-16 Thread Erik Allik
Seems like you have a lot of URLs hardcoded -- you shouldn't do that. Use MEDIA_URL for static media files and the {% url %} tag for dynamic URLs (or django.core.urlresolvers.reverse in Python code). Erik On 16.09.2008, at 11:02, est wrote: > > Today, my boss came to me and asked: "Please m

Re: Absolute URL vs Relative URL, or ~ ?

2008-09-16 Thread Tim Kersten
The domain isn't changing. It's just the path, so links that use absolute paths will break. In a way I get it - using relative urls is easy to break something if you need to move it. Also copy & paste becomes hard. Perhaps an APPNAME_URL in your request context would help? Tim ^,^ 2008/9/16 Ja

Re: Absolute URL vs Relative URL, or ~ ?

2008-09-16 Thread Tim Kersten
Isn't that what MEDIA_URL is for? At least for your images and css resources. And as for the rest of the urls... urls.py? Tim ^,^ On Tue, Sep 16, 2008 at 9:02 AM, est <[EMAIL PROTECTED]> wrote: > > Today, my boss came to me and asked: "Please move our django site from > http://xxx.com/ to htt

Re: Absolute URL vs Relative URL, or ~ ?

2008-09-16 Thread Jarek Zgoda
Wiadomość napisana w dniu 2008-09-16, o godz. 10:02, przez est: > > Today, my boss came to me and asked: "Please move our django site from > http://xxx.com/ to http://xxx.com/v2/"; > > It's killing me. Just image how huge mount of HTML source code to > modify. > > I STRONGLY suggest django implem

Absolute URL vs Relative URL, or ~ ?

2008-09-16 Thread est
Today, my boss came to me and asked: "Please move our django site from http://xxx.com/ to http://xxx.com/v2/"; It's killing me. Just image how huge mount of HTML source code to modify. I STRONGLY suggest django implement a 'project url' like asp.net, say where ~ always points to the current d

Re: Get an absolute URL including host

2008-07-07 Thread Rajesh Dhawan
Hi Florian, Florian Lindner wrote: > Hello, > > how can I get an absolute URL including a hostname (e.g. > http://www.example.org/dir/doc.html) > in a template. I have an object which get_absolute_url I can use but > what is the best way of getting the hostname in the t

Re: Get an absolute URL including host

2008-07-06 Thread Malcolm Tredinnick
On Sun, 2008-07-06 at 15:21 +0200, Florian Lindner wrote: > Hello, > > how can I get an absolute URL including a hostname (e.g. > http://www.example.org/dir/doc.html) > in a template. I have an object which get_absolute_url I can use but > what is the best way of getti

Get an absolute URL including host

2008-07-06 Thread Florian Lindner
Hello, how can I get an absolute URL including a hostname (e.g. http://www.example.org/dir/doc.html) in a template. I have an object which get_absolute_url I can use but what is the best way of getting the hostname in the template? Thanks, Florian

Re: absolute url overrides

2008-05-04 Thread Thierry
I read that doc many times :) Missed that little detail every time though. Thanks for the help! --~--~-~--~~~---~--~~ 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@g

Re: absolute url overrides

2008-05-03 Thread Karen Tracey
c ( http://www.djangoproject.com/documentation/settings/#absolute-url-overrides) says this is a mapping of ''"app_label.model_name" strings'. App_label, I believe, is only the rightmost part of the Python path to the application (in this case django.contrib.auth, so for rig

absolute url overrides

2008-05-03 Thread Thierry
ABSOLUTE_URL_OVERRIDES = { 'django.contrib.auth.models.user': lambda o: "/members/%s/" % o.username, } Doesn't seem to be working, any idea why? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" grou

Re: Model Absolute URL

2008-03-31 Thread jurian
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 o

Re: Model Absolute URL

2008-03-31 Thread Malcolm Tredinnick
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 th

Model Absolute URL

2008-03-31 Thread jurian
Is there any way apart from the following to get the absolute URL of an object? opts = model._meta url = "../../../%s/%s/add/" % (opts.app_label.lower(), opts.object_name.lower()) --~--~-~--~~~---~--~~ You received this message because you are subscri

Re: Help with get absolute url

2006-12-14 Thread conrad22
You were quite right, Wayne, there was a mistake in my model (Charfield instead of SlugField)...so don't I feel stupid! A million thanks to everyone anyway! (I feel quite well qualified to write an idiot's guide now...) --~--~-~--~~~---~--~~ You received this me

Re: Help with get absolute url

2006-12-14 Thread Waylan Limberg
This isn't working for you? {% for organisation in object.organisation_set.all %} {{ organisation.org_name }} {% endfor %} If the name works, but not get_absolute_url I'd say you have something wrong with your model. Open a shell and play with you model to make sure everything is wor

Re: Help with get absolute url

2006-12-14 Thread conrad22
In other words, why can't I simply put {{organisation.get_absolute_url}} to return the organisation's detail page? Surely the whole point of the get_absolute_url is to be able to call an object from wherever? So what would I put in the model and/or urls.py to be able to do this? At the moment I

Re: Help with get absolute url

2006-12-13 Thread conrad22
Mmm...I actually got it to work in the category_detail template: {% for organisation in object.organisation_set.all %} {{organisation.org_name}} {% endfor %} Each category does return a list of the organisations that are in it, but what I need to do is then simply provide access to

Re: Help with get absolute url

2006-12-13 Thread Waylan Limberg
On 12/13/06, conrad22 <[EMAIL PROTECTED]> wrote: > > Yes, I know. Sorry, should have been more specific: > the problem is, that the second part of the url pattern comes from a > different model. > > I've tried > (r'^categories/(?P\d+)/(?P\w+)/$','django.views.generic.list_detail.object_detail', >

Re: Help with get absolute url

2006-12-13 Thread conrad22
Yes, I know. Sorry, should have been more specific: the problem is, that the second part of the url pattern comes from a different model. I've tried (r'^categories/(?P\d+)/(?P\w+)/$','django.views.generic.list_detail.object_detail', info_dict), but it's obviously not quite there...? How would I

Re: Help with get absolute url

2006-12-12 Thread Brett Parker
On Tue, Dec 12, 2006 at 11:13:52AM -0800, conrad22 wrote: > > Woops..see, I am already mad, as I have not communicated the actual > problem.. > > The last bit - 'categories/1/k/' returns a page/url not found error, > as follows: > > Request Method: GET > Request URL: http://127.0.0.

Re: Help with get absolute url

2006-12-12 Thread conrad22
Woops..see, I am already mad, as I have not communicated the actual problem.. The last bit - 'categories/1/k/' returns a page/url not found error, as follows: Request Method: GET Request URL:http://127.0.0.1:8000/categories/1/k/ Using the URLconf defined in kvn.urls, Django tri

Help with get absolute url

2006-12-12 Thread conrad22
Hi Hopefully someone can step in here before I go totally mad... I am trying to define the absolute_url and/or the urls.py file to arrive at the following: A list of categories, which leads to a list of organisations in each category. I want then each organisation in the list to go to its generi