isaac1m / django-qrcode Goto Github PK
View Code? Open in Web Editor NEWThis project forked from pablorecio/django-qrcode
Simple django application to simplify the inclusion of QR codes
License: GNU Lesser General Public License v3.0
This project forked from pablorecio/django-qrcode
Simple django application to simplify the inclusion of QR codes
License: GNU Lesser General Public License v3.0
.. 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" %} Example when looping on a list of QR codes to generate:: {% for qrcode in qrcode_list %} <p class="qrcodeImage">{% qr_from_text "text" "size" %} {% endfor %} 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 previously * 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': '[email protected]', '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 previously * 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.googleapis.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*.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.