.. contents::
=========
Django QR
=========
Information
===========
Django QR is a simple Django application that provides some templatetags
that allows to include automatically QR codes on the Django site.
Installation
============
Once is installed from PyPI, you just need to add it to your settings as
'qrcode':
::
INSTALLED_APPS = (..., 'qrcode', ...)
Usage
=====
Its usage is very simple. You just need to use the templatetag as follows:
::
{% load qr_tags %}
...
{% qr_from_text "text" "size" %}
or
{% qr_from_mail "mail_address" "size" %}
Where:
* Size is not mandatory, and defines the dimensions of the QR code as following: 's' (120x120 pixels), 'm' (230x230 pixels), 'l' (350x350) or an integer with the size that you want to give to the QR-code (like 40, 80 or 500). Any other option will be ignored and will use 'm' as default.
* qr_from_mail tag just add a simple "mailto:" at the beggining, because some qr scanners can detect that as an email address in order to send it an email.
QR-code for contact information
-------------------------------
There's also a templatetag to render a QR-code that allows to store
some contact information, such as name, phone number, email address or
our company name.
Its usage is similiar to the basics:
::
{% qr_from contact contact "size" %}
Where:
* Size is the same as previosly
* contact should be a Python dictionary (or any other hash structure) that could contain the following elements:
* *name* - Complete name
* *phone_number*
* *email*
* *url* - some url address, your blog or personal webpage
* *company*
For instance, you could create a contact dictionary like the following:
::
contact = {
'name': 'Pablo Recio',
'phone_number': '00000000',
'email': 'foo@example.com',
'url': 'http://www.zocolab.es',
'company': 'Zocolab',
}
QR-code of Django object URL
----------------------------
Another templatetag can be used to render a QR-code that links to a Django object URL. As
the previous templatetags, the usage is very simple:
::
{% qr_from_object object "size" %}
Where:
* Size is the same as previosly
* Object it's an instance of a Django model, that must implements the 'get_absolute_url' method in order to get the object's address.
Change service for QR generating
--------------------------------
By default, django-qr uses Google Chart for generating the QR-code. But this can be changed with a new template. The default
template *qrcode/qr_tag.html* contains the following:
::
<img src="http://chart.apis.google.com/chart?cht=qr&chs={{ size }}x{{ size }}&chl={{ text }}" />
But if you want to use some other service, like *qrserver*, you just need to add a new template in your templates dirs with
the following code:
::
<img src="http://api.qrserver.com/v1/create-qr-code/?size={{ size }}x{{ size }}&data={{ text }}" />
The idea is that your *qrcode/qr_tag.html* contains an img tag and the call to the service that you want, mantaining the
variables *size* and *data*.
Raw data
{
"_id": null,
"home_page": "https://github.com/zocolab/django-qrcode",
"name": "django-qrcode",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "django qr code qrcode",
"author": "Pablo Recio Quijano",
"author_email": "pablo@zocolab.es",
"download_url": "https://files.pythonhosted.org/packages/8b/2f/4263fba93ae6a46776d6a8359ff1e192f38dffcc6f2925d29463375254fa/django-qrcode-0.3.tar.gz",
"platform": "UNKNOWN",
"description": ".. contents::\n\n=========\nDjango QR\n=========\n\nInformation\n===========\n\nDjango QR is a simple Django application that provides some templatetags\nthat allows to include automatically QR codes on the Django site.\n\nInstallation\n============\n\nOnce is installed from PyPI, you just need to add it to your settings as\n'qrcode':\n\n::\n\n INSTALLED_APPS = (..., 'qrcode', ...)\n\nUsage\n=====\n\nIts usage is very simple. You just need to use the templatetag as follows:\n\n::\n\n {% load qr_tags %}\n\n ...\n\n {% qr_from_text \"text\" \"size\" %}\n or\n {% qr_from_mail \"mail_address\" \"size\" %}\n\n\nWhere:\n\n * Size is not mandatory, and defines the dimensions of the QR code as following: 's' (120x120 pixels), 'm' (230x230 pixels), 'l' (350x350) or an integer with the size that you want to give to the QR-code (like 40, 80 or 500). Any other option will be ignored and will use 'm' as default.\n * qr_from_mail tag just add a simple \"mailto:\" at the beggining, because some qr scanners can detect that as an email address in order to send it an email.\n\nQR-code for contact information\n-------------------------------\n\nThere's also a templatetag to render a QR-code that allows to store\nsome contact information, such as name, phone number, email address or\nour company name.\n\nIts usage is similiar to the basics:\n\n::\n\n {% qr_from contact contact \"size\" %}\n\nWhere:\n\n * Size is the same as previosly\n * contact should be a Python dictionary (or any other hash structure) that could contain the following elements:\n\n * *name* - Complete name\n * *phone_number*\n * *email*\n * *url* - some url address, your blog or personal webpage\n * *company*\n\nFor instance, you could create a contact dictionary like the following:\n\n::\n\n contact = {\n 'name': 'Pablo Recio',\n 'phone_number': '00000000',\n 'email': 'foo@example.com',\n 'url': 'http://www.zocolab.es',\n 'company': 'Zocolab',\n }\n\n\nQR-code of Django object URL\n----------------------------\n\nAnother templatetag can be used to render a QR-code that links to a Django object URL. As\nthe previous templatetags, the usage is very simple:\n\n::\n {% qr_from_object object \"size\" %}\n\nWhere:\n\n * Size is the same as previosly\n * Object it's an instance of a Django model, that must implements the 'get_absolute_url' method in order to get the object's address.\n\nChange service for QR generating\n--------------------------------\n\nBy default, django-qr uses Google Chart for generating the QR-code. But this can be changed with a new template. The default\ntemplate *qrcode/qr_tag.html* contains the following:\n\n::\n\n<img src=\"http://chart.apis.google.com/chart?cht=qr&chs={{ size }}x{{ size }}&chl={{ text }}\" />\n\nBut if you want to use some other service, like *qrserver*, you just need to add a new template in your templates dirs with\nthe following code:\n\n::\n\n<img src=\"http://api.qrserver.com/v1/create-qr-code/?size={{ size }}x{{ size }}&data={{ text }}\" />\n\nThe idea is that your *qrcode/qr_tag.html* contains an img tag and the call to the service that you want, mantaining the\nvariables *size* and *data*.",
"bugtrack_url": null,
"license": "LGPL 3",
"summary": "Django application that provides simple templatetags to generate QR-codes",
"version": "0.3",
"project_urls": {
"Download": "UNKNOWN",
"Homepage": "https://github.com/zocolab/django-qrcode"
},
"split_keywords": [
"django",
"qr",
"code",
"qrcode"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8b2f4263fba93ae6a46776d6a8359ff1e192f38dffcc6f2925d29463375254fa",
"md5": "ce398a6b424100421b0970280f826176",
"sha256": "88598af03087859c30b83ecd345dd3e988d739f13543e0bef9274eda18d55e0c"
},
"downloads": -1,
"filename": "django-qrcode-0.3.tar.gz",
"has_sig": false,
"md5_digest": "ce398a6b424100421b0970280f826176",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4188,
"upload_time": "2011-12-13T10:03:08",
"upload_time_iso_8601": "2011-12-13T10:03:08.524498Z",
"url": "https://files.pythonhosted.org/packages/8b/2f/4263fba93ae6a46776d6a8359ff1e192f38dffcc6f2925d29463375254fa/django-qrcode-0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2011-12-13 10:03:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "zocolab",
"github_project": "django-qrcode",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "django-qrcode"
}