django-absoluteuri 1.0.0
pip install django-absoluteuri==1.0.0
Released:
Absolute URI functions and template tags for Django
Navigation
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: Apache Software License (Apache 2.0)
- Author: Fusionbox, Inc.
- Tags django-absoluteuri
Classifiers
- Development Status
- Framework
- Intended Audience
- License
- Natural Language
- Programming Language
Project description
django-absoluteuri
Absolute URI functions and template tags for Django.
Why
There are times when you need to output an absolute URL (for example, inside an email), but you don’t always have access to the request. These utilities use the Sites Framework if available in order to create absolute URIs.
Installation
Install django-absoluteuri:
pip install django-absoluteuri
Then add it to your INSTALLED_APPS:
INSTALLED_APPS = ( # ... 'absoluteuri', )
Template Tags
There are two template tags, absoluteuri and absolutize. absoluteuri works just like the url tag, but that it outputs absolute URLs.
{% load absoluteuri %}
<a href="{% absoluteuri 'my_view' kwarg1='foo' kwarg2='bar' %}">click here</a>
absolutize will take a relative URL and return an absolute URL.
{% load absoluteuri %}
<a href="{% absolutize url_from_context %}">click here</a>
Functions
There are also two functions that django-absoluteuri provides, build_absolute_uri and reverse, which are equivalents of request.build_absolute_url and urlresolvers.reverse.
>>> import absoluteuri
>>> my_relative_url = '/path/to/somewhere/'
>>> absoluteuri.build_absolute_uri(my_relative_url)
'http://example.com/path/to/somewhere/'
>>> absoluteuri.reverse('viewname', kwargs={'foo': 'bar'})
'http://example.com/path/to/bar/'
Changelog
1.0.0 (2015-03-17)
First release on PyPI.
Project details
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: Apache Software License (Apache 2.0)
- Author: Fusionbox, Inc.
- Tags django-absoluteuri
Classifiers
- Development Status
- Framework
- Intended Audience
- License
- Natural Language
- Programming Language
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-absoluteuri-1.0.0.zip
.
File metadata
- Download URL: django-absoluteuri-1.0.0.zip
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
b71148b929a3a7d87630e2ab267389123783e4776184f0fcb5fd3837309cbcc2
|
|
MD5 |
859364ec01645aaa73e4b3250b6e1cb6
|
|
BLAKE2b-256 |
10080edef7f5d0a3705d85264debadd7db4935fd40bac70ea0422f815609fe7b
|