Re: [Django] #10944: Site app should be able to make absolute URLs.

7 views
Skip to first unread message

Django

unread,
Jul 10, 2011, 7:47:09 PM7/10/11
to django-...@googlegroups.com
#10944: Site app should be able to make absolute URLs.
---------------------------------------+-------------------------------
Reporter: jdunck | Owner:
Type: New feature | Status: new
Milestone: | Component: contrib.sites
Version: 1.0 | Severity: Normal
Resolution: | Keywords:
Triage Stage: Accepted | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
---------------------------------------+-------------------------------
Changes (by laurentluce):

* status: assigned => new
* owner: laurentluce =>
* ui_ux: => 0
* easy: => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/10944#comment:14>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Feb 4, 2012, 3:47:24 PM2/4/12
to django-...@googlegroups.com
#10944: Site app should be able to make absolute URLs.
-------------------------------+------------------------------------
Reporter: jdunck | Owner:
Type: New feature | Status: new
Component: contrib.sites | Version: 1.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

Comment (by oinopion):

site_url tag is a bit useless, as it take path as string. IMHO it should
work like the url tag taking names and parameters.

--
Ticket URL: <https://code.djangoproject.com/ticket/10944#comment:15>

Django

unread,
Jun 22, 2012, 2:18:59 PM6/22/12
to django-...@googlegroups.com
#10944: Site app should be able to make absolute URLs.
-------------------------------+--------------------------------------
Reporter: jdunck | Owner: krzysiumed
Type: New feature | Status: new
Component: contrib.sites | Version: 1.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by krzysiumed):

* owner: => krzysiumed
* cc: krzysiumed@… (added)


Comment:

I added my draft where `site_url` is similar to `url` tag (actually it
calls the `url` tag function and create instance of `URLNode` to avoid
redundancy). It includes tests and docs but my english is poor. An example
of using my `site_url`:

{{{
{% site_url site 'myapp.views.viewname' %} ==>
'http://example.com/path/to/view'
{% site_url site using https 'myapp.views.viewname' %} ==>
'https://example.com/path/to/view'
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/10944#comment:16>

Django

unread,
Jun 26, 2012, 10:35:44 AM6/26/12
to django-...@googlegroups.com
#10944: Site app should be able to make absolute URLs.
-------------------------------+--------------------------------------
Reporter: jdunck | Owner: krzysiumed
Type: New feature | Status: assigned
Component: contrib.sites | Version: 1.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by krzysiumed):

* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/10944#comment:17>

Django

unread,
Jun 13, 2014, 8:25:02 PM6/13/14
to django-...@googlegroups.com
#10944: Site app should be able to make absolute URLs.
-------------------------------+--------------------------------------
Reporter: jdunck | Owner: krzysiumed
Type: New feature | Status: assigned
Component: contrib.sites | Version: 1.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by timo):

* needs_better_patch: 0 => 1


Comment:

Patch no longer applies cleanly.

--
Ticket URL: <https://code.djangoproject.com/ticket/10944#comment:18>

Django

unread,
Feb 12, 2015, 9:47:34 AM2/12/15
to django-...@googlegroups.com
#10944: Site app should be able to make absolute URLs.
-------------------------------+--------------------------------------
Reporter: jdunck | Owner: krzysiumed
Type: New feature | Status: assigned
Component: contrib.sites | Version: 1.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------

Comment (by mbertheau):

Replying to [comment:9 SmileyChris]:
> What's actually the good in the `{% site_url %}` tag? It seems like it
should be able to take other sites, too (if you only have one site, why
bother using this over the standard `request.build_absolute_uri()`?)

I often find myself in a situation where I need an absolute URL but cannot
use `request.build_absolute_uri()` because I don't have a request: cron
jobs, celery tasks or api modules that I don't want to couple to the
request. Afaics Django currently doesn't have a place to generate absolute
URLs without a request, so everyone is hacking their own way. `Site` is a
possible place to do it, but it'd have to learn about the scheme and port
to be complete. `RequestSite` could take these from new settings, maybe:
`SITE_SCHEME`, `SITE_PORT`.

--
Ticket URL: <https://code.djangoproject.com/ticket/10944#comment:19>

Django

unread,
Feb 8, 2018, 7:01:38 AM2/8/18
to django-...@googlegroups.com
#10944: Site app should be able to make absolute URLs.
-------------------------------------+-------------------------------------
Reporter: Jeremy Dunck | Owner:
| Christopher Medrela

Type: New feature | Status: assigned
Component: contrib.sites | Version: 1.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by André Cruz):

* cc: André Cruz (added)


Comment:

Seems like this would be a pretty useful feature to have, and one that I
need.

Is any one of those "hacks" blessed by the Django community? I'm doing
this:


{{{
def handcraft_absolute_url(path):
domain = Site.objects.get_current().domain
scheme = 'https' if SESSION_COOKIE_SECURE else 'http'
return '{scheme}://{domain}{path}'.format(domain=domain, path=path,
scheme=scheme)
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/10944#comment:20>

Reply all
Reply to author
Forward
0 new messages