Opened 9 years ago

Last modified 8 years ago

#26079 closed New feature

add prefered/default protocol in the sites framework — at Initial Version

Reported by: Eric Owned by: nobody
Component: contrib.sites Version: dev
Severity: Normal Keywords: sites protocol
Cc: Eric Triage Stage: Someday/Maybe
Has patch: no Needs documentation: no
Needs tests: yes Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

I think adding a prefered/default protocol in the sites framework would be a great addition for generating full url's to django websites.

specially when generating url from action not coming from a request like the sitemaps ping_google that assumes the protocol to be http:

    current_site = Site.objects.get_current()
    url = "http://%s%s" % (current_site.domain, sitemap_url)

so we could have something like this instead:

    current_site = Site.objects.get_current()
    url = "%s://%s%s" % (current_site.protocol, current_site.domain, sitemap_url)

and maybe even add a shortcut for the site's base url

Change History (1)

by Eric, 9 years ago

Attachment: sites.patch added

proposed changes

Note: See TracTickets for help on using tickets.
Back to Top