django-qr-code


Namedjango-qr-code JSON
Version 4.1.0 PyPI version JSON
download
home_pagehttps://github.com/dprog-philippe-docourt/django-qr-code
SummaryAn application that provides tools for displaying QR codes on your Django site.
upload_time2024-06-01 13:11:12
maintainerPhilippe Docourt
docs_urlNone
authorPhilippe Docourt
requires_python>=3.10
licenseBSD 3-clause
keywords qr code django
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Django QR Code
[![Latest PyPI version](https://badge.fury.io/py/django-qr-code.svg)](https://badge.fury.io/py/django-qr-code)
[![Downloads](https://img.shields.io/pypi/dm/django-qr-code.svg)](https://pypi.python.org/pypi/django-qr-code)
[![Documentation Status](https://readthedocs.org/projects/django-qr-code/badge/?version=latest)](https://django-qr-code.readthedocs.io/latest/pages/README.html)
[![Build and Test](https://github.com/dprog-philippe-docourt/django-qr-code/actions/workflows/ci.yml/badge.svg)](https://github.com/dprog-philippe-docourt/django-qr-code/actions)
[![Maintainability](https://api.codeclimate.com/v1/badges/c47e79bf51f6a2bb8264/maintainability)](https://codeclimate.com/github/dprog-philippe-docourt/django-qr-code/maintainability)

This is an application that provides tools for displaying QR codes on your [Django](https://www.djangoproject.com/) site.

This application depends on the [Segno QR Code generator](https://pypi.org/project/segno/) library.

This app makes no usage of the Django models and therefore do not use any database.

Only Python >= 3.10 is supported.

## Features

* Generate QR codes as embedded SVG or PNG images in HTML templates.
* Customize QR codes with various parameters (size, error correction, border, etc.).
* Generate URLs for QR code images.
* Support for specific application QR codes (e.g., contact info, Wi-Fi config).
* Cache QR code images for performance.
* Secure QR code image serving with URL protection and user authentication.

## Installation

### Binary Package from PyPi
In order to use this app in a Django project, the simplest way is to install it from [PyPi](https://pypi.python.org/pypi/django-qr-code):
```bash
pip install django-qr-code
```

### From the Source Code
In order to modify or test this app you may want to install it from the source code.

Clone the [GitHub repository](https://github.com/dprog-philippe-docourt/django-qr-code) and install dependencies:
```bash
git clone https://github.com/dprog-philippe-docourt/django-qr-code
pip install -r requirements.txt -r requirements-dev.txt
python manage.py collectstatic --no-input
```

## Usage
Start by adding `qr_code` to your `INSTALLED_APPS` setting like this:
```python
INSTALLED_APPS = (
    # ...,
    'qr_code',
)
```

You need to load the tags provided by this app in your template with:
```htmldjango
{% load qr_code %}
```

The source code on [GitHub](https://github.com/dprog-philippe-docourt/django-qr-code) contains a simple demo app. Please check out the [templates folder](https://github.com/dprog-philippe-docourt/django-qr-code/tree/master/qr_code_demo/templates/qr_code_demo) for an example of template, and the [setting](https://github.com/dprog-philippe-docourt/django-qr-code/tree/master/demo_site/settings.py) and [urls](https://github.com/dprog-philippe-docourt/django-qr-code/tree/master/demo_site/urls.py) files for an example of configuration and integration.

### Example: Inline QR Code

Generate a simple QR code:

```htmldjango
{% qr_from_text "Hello World!" size="T" %}
```
### Example: URL QR Code

Generate a URL for a QR code image:

```htmldjango
<img src="{% qr_url_from_text "Hello World!" %}" alt="Hello World!">
```

### Advanced Usage of Tags

Refer to the [official documentation for tags](https://django-qr-code.readthedocs.io/latest/pages/template-tags.html) for more detailed information and advanced usage examples.

### Demo Application
If you want to try this app, you may want to use the demo application shipped alongside the source code.

Get the source code from [GitHub](https://github.com/dprog-philippe-docourt/django-qr-code), follow the [installation instructions](#from-the-source-code) above, and run the `runserver` command of Django:
```bash
python manage.py runserver
```
The demo application should be running at <http://127.0.0.1:8000/qr-code-demo/>.

If you have [Docker Compose](https://docs.docker.com/compose/) installed, you can simply run the following from a terminal (this will save you the burden of setting up a proper python environment):
```bash
cd scripts
./run-demo-app.sh
```
The demo application should be running at <http://127.0.0.1:8910/qr-code-demo/>.

## Generating Image Object Representing a QR Code

If you do not want to use Django tags for rendering QR code in a template, you can simply use the API in your code. For instance, `qr_code.qrcode.maker.make_qr_code_image` will return bytes representing an image according to the image_format passed in the `qr_code_options` parameter.

Refer to the [official API documentation](https://django-qr-code.readthedocs.io/latest/pages/api.html) for more detailed information.

## Testing
Get the source code from [GitHub](https://github.com/dprog-philippe-docourt/django-qr-code), follow the [installation instructions](#from-the-source-code) above, and run the `test` command of Django:
```bash
python manage.py test
```
This will run the test suite with the locally installed version of Python and Django.

If you have [Docker Compose](https://docs.docker.com/compose/) installed, you can simply run the following from a terminal (this will save you the burden of setting up a proper python environment):
```bash
cd scripts
./run-tests.sh
```
This will run the test suite with all supported versions of Python and Django. The test results are stored within `tests_result` folder.

## Projects Using this App

This app is used in the following projects:
* [MyGym Web](https://mygym-web.ch/): a web platform for managing sports clubs. The QR codes are used for importing members' contact information in a phone book.
* [Gymna-Score](https://gymna-score.acjg.ch/): a web platform for entering scores during gymnastics competitions organized by the Association Cantonale Jurassienne de Gymnastique (ACJG). The QR codes are used to provide an easy way for the public to follow an ongoing competition. They are also used to authenticate judges that need to enter scores.
* [AC-Ju](https://www.ac-ju.ch/): a website that generates digital vouchers that can be redeemed at affiliate merchants.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/dprog-philippe-docourt/django-qr-code",
    "name": "django-qr-code",
    "maintainer": "Philippe Docourt",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "qr code django",
    "author": "Philippe Docourt",
    "author_email": "philippe@docourt.ch",
    "download_url": "https://files.pythonhosted.org/packages/55/52/aa10881dec67bdd016a90edb309384c7271791c4eda1e2ce5b0eaab06df2/django_qr_code-4.1.0.tar.gz",
    "platform": null,
    "description": "# Django QR Code\n[![Latest PyPI version](https://badge.fury.io/py/django-qr-code.svg)](https://badge.fury.io/py/django-qr-code)\n[![Downloads](https://img.shields.io/pypi/dm/django-qr-code.svg)](https://pypi.python.org/pypi/django-qr-code)\n[![Documentation Status](https://readthedocs.org/projects/django-qr-code/badge/?version=latest)](https://django-qr-code.readthedocs.io/latest/pages/README.html)\n[![Build and Test](https://github.com/dprog-philippe-docourt/django-qr-code/actions/workflows/ci.yml/badge.svg)](https://github.com/dprog-philippe-docourt/django-qr-code/actions)\n[![Maintainability](https://api.codeclimate.com/v1/badges/c47e79bf51f6a2bb8264/maintainability)](https://codeclimate.com/github/dprog-philippe-docourt/django-qr-code/maintainability)\n\nThis is an application that provides tools for displaying QR codes on your [Django](https://www.djangoproject.com/) site.\n\nThis application depends on the [Segno QR Code generator](https://pypi.org/project/segno/) library.\n\nThis app makes no usage of the Django models and therefore do not use any database.\n\nOnly Python >= 3.10 is supported.\n\n## Features\n\n* Generate QR codes as embedded SVG or PNG images in HTML templates.\n* Customize QR codes with various parameters (size, error correction, border, etc.).\n* Generate URLs for QR code images.\n* Support for specific application QR codes (e.g., contact info, Wi-Fi config).\n* Cache QR code images for performance.\n* Secure QR code image serving with URL protection and user authentication.\n\n## Installation\n\n### Binary Package from PyPi\nIn order to use this app in a Django project, the simplest way is to install it from [PyPi](https://pypi.python.org/pypi/django-qr-code):\n```bash\npip install django-qr-code\n```\n\n### From the Source Code\nIn order to modify or test this app you may want to install it from the source code.\n\nClone the [GitHub repository](https://github.com/dprog-philippe-docourt/django-qr-code) and install dependencies:\n```bash\ngit clone https://github.com/dprog-philippe-docourt/django-qr-code\npip install -r requirements.txt -r requirements-dev.txt\npython manage.py collectstatic --no-input\n```\n\n## Usage\nStart by adding `qr_code` to your `INSTALLED_APPS` setting like this:\n```python\nINSTALLED_APPS = (\n    # ...,\n    'qr_code',\n)\n```\n\nYou need to load the tags provided by this app in your template with:\n```htmldjango\n{% load qr_code %}\n```\n\nThe source code on [GitHub](https://github.com/dprog-philippe-docourt/django-qr-code) contains a simple demo app. Please check out the [templates folder](https://github.com/dprog-philippe-docourt/django-qr-code/tree/master/qr_code_demo/templates/qr_code_demo) for an example of template, and the [setting](https://github.com/dprog-philippe-docourt/django-qr-code/tree/master/demo_site/settings.py) and [urls](https://github.com/dprog-philippe-docourt/django-qr-code/tree/master/demo_site/urls.py) files for an example of configuration and integration.\n\n### Example: Inline QR Code\n\nGenerate a simple QR code:\n\n```htmldjango\n{% qr_from_text \"Hello World!\" size=\"T\" %}\n```\n### Example: URL QR Code\n\nGenerate a URL for a QR code image:\n\n```htmldjango\n<img src=\"{% qr_url_from_text \"Hello World!\" %}\" alt=\"Hello World!\">\n```\n\n### Advanced Usage of Tags\n\nRefer to the [official documentation for tags](https://django-qr-code.readthedocs.io/latest/pages/template-tags.html) for more detailed information and advanced usage examples.\n\n### Demo Application\nIf you want to try this app, you may want to use the demo application shipped alongside the source code.\n\nGet the source code from [GitHub](https://github.com/dprog-philippe-docourt/django-qr-code), follow the [installation instructions](#from-the-source-code) above, and run the `runserver` command of Django:\n```bash\npython manage.py runserver\n```\nThe demo application should be running at <http://127.0.0.1:8000/qr-code-demo/>.\n\nIf you have [Docker Compose](https://docs.docker.com/compose/) installed, you can simply run the following from a terminal (this will save you the burden of setting up a proper python environment):\n```bash\ncd scripts\n./run-demo-app.sh\n```\nThe demo application should be running at <http://127.0.0.1:8910/qr-code-demo/>.\n\n## Generating Image Object Representing a QR Code\n\nIf you do not want to use Django tags for rendering QR code in a template, you can simply use the API in your code. For instance, `qr_code.qrcode.maker.make_qr_code_image` will return bytes representing an image according to the image_format passed in the `qr_code_options` parameter.\n\nRefer to the [official API documentation](https://django-qr-code.readthedocs.io/latest/pages/api.html) for more detailed information.\n\n## Testing\nGet the source code from [GitHub](https://github.com/dprog-philippe-docourt/django-qr-code), follow the [installation instructions](#from-the-source-code) above, and run the `test` command of Django:\n```bash\npython manage.py test\n```\nThis will run the test suite with the locally installed version of Python and Django.\n\nIf you have [Docker Compose](https://docs.docker.com/compose/) installed, you can simply run the following from a terminal (this will save you the burden of setting up a proper python environment):\n```bash\ncd scripts\n./run-tests.sh\n```\nThis will run the test suite with all supported versions of Python and Django. The test results are stored within `tests_result` folder.\n\n## Projects Using this App\n\nThis app is used in the following projects:\n* [MyGym Web](https://mygym-web.ch/): a web platform for managing sports clubs. The QR codes are used for importing members' contact information in a phone book.\n* [Gymna-Score](https://gymna-score.acjg.ch/): a web platform for entering scores during gymnastics competitions organized by the Association Cantonale Jurassienne de Gymnastique (ACJG). The QR codes are used to provide an easy way for the public to follow an ongoing competition. They are also used to authenticate judges that need to enter scores.\n* [AC-Ju](https://www.ac-ju.ch/): a website that generates digital vouchers that can be redeemed at affiliate merchants.\n",
    "bugtrack_url": null,
    "license": "BSD 3-clause",
    "summary": "An application that provides tools for displaying QR codes on your Django site.",
    "version": "4.1.0",
    "project_urls": {
        "Homepage": "https://github.com/dprog-philippe-docourt/django-qr-code"
    },
    "split_keywords": [
        "qr",
        "code",
        "django"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fb2697fbc45a02c66b8ed7e6b013962b4c59ab8a8d731ec1906fe0bc5db52399",
                "md5": "a38771d8d4fcd7246977799893a605d6",
                "sha256": "000ae66411a13ce9b21c2631177b3f457614528c8866ebff3f7e991f4b6082b7"
            },
            "downloads": -1,
            "filename": "django_qr_code-4.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a38771d8d4fcd7246977799893a605d6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 24717,
            "upload_time": "2024-06-01T13:11:09",
            "upload_time_iso_8601": "2024-06-01T13:11:09.766024Z",
            "url": "https://files.pythonhosted.org/packages/fb/26/97fbc45a02c66b8ed7e6b013962b4c59ab8a8d731ec1906fe0bc5db52399/django_qr_code-4.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5552aa10881dec67bdd016a90edb309384c7271791c4eda1e2ce5b0eaab06df2",
                "md5": "11ed9557015b1da287c094324cf7bd65",
                "sha256": "0d236a2385385cb8570a7191597120be6abfc5ca2ad49aabe2b182ddb28c12b0"
            },
            "downloads": -1,
            "filename": "django_qr_code-4.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "11ed9557015b1da287c094324cf7bd65",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 25762,
            "upload_time": "2024-06-01T13:11:12",
            "upload_time_iso_8601": "2024-06-01T13:11:12.295633Z",
            "url": "https://files.pythonhosted.org/packages/55/52/aa10881dec67bdd016a90edb309384c7271791c4eda1e2ce5b0eaab06df2/django_qr_code-4.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-01 13:11:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dprog-philippe-docourt",
    "github_project": "django-qr-code",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "django-qr-code"
}
        
Elapsed time: 0.62412s