Name | wagtail-qrcode JSON |
Version |
2.1.0
JSON |
| download |
home_page | None |
Summary | Create a QR code that can be used to link to a wagtail page |
upload_time | 2024-07-14 16:03:36 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | MIT License Copyright (c) 2022, Nick Moreton Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
wagtail
qrcode
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
|
# Wagtail QR code
This package can be used to create a page in Wagtail CMS that has a corresponding QR Code.
![Alt text](docs/sample.png?raw=true "Title")
## Features
- The generated QR Code is saved as an EPS document that can be printed. When scanned IT will link to the page via a redirect using the page ID
- You can download the generated QR code and use it in printed advertising like posters, postcards, banners, beer mats and more.
- When saving a draft or publishing a page you can add a one-time email address to send the qr-code to as an attachment.
## Installation
To add the package to your own Wagtail CMS
**Install the package into your environment.**
```bash
pip install wagtail-qrcode
```
**Add the package to your site settings.**
```python
INSTALLED_APPS = [
# ...
"wagtail_qrcode",
# ...
]
```
**Add this setting to your Wagtail settings.**
It is used to generate the base url for the QR code
```python
WAGTAIL_QR_CODE_BASE_URL = "your-site-url"
```
You'll likely want to test the QRcode using another device. Your device will need to be able to resolve your testing domain and localhost probably won't work.
Try using a service like [ngrok](https://ngrok.com/) to set up a url to your localhost and use that domain name as in the `WAGTAIL_QR_CODE_BASE_URL` setting.
This is the command I use to start ngrok.
```bash
./ngrok http 8000 --scheme=http
```
## Using the QRCode page model mixin
Use the model mixin in a new or an existing page model.
```python
# models.py
from wagtail.admin.panels import (
FieldPanel,
MultiFieldPanel,
ObjectList,
TabbedInterface,
)
from wagtail.models import Page
from wagtail_qrcode.admin_forms import QrCodeEmailForm
from wagtail_qrcode.models import QRCodeMixin
class QRCodePage(QRCodeMixin, Page):
qrcode_panels = QRCodeMixin.panels + [
MultiFieldPanel(
[
FieldPanel("email_address"),
FieldPanel("email_subject"),
FieldPanel("email_body"),
],
heading="Send QR code via email",
)
]
edit_handler = TabbedInterface(
[
ObjectList(Page.content_panels, heading="Content"),
ObjectList(Page.promote_panels, heading="Promote"),
ObjectList(Page.settings_panels, heading="Settings", classname="settings"),
ObjectList(qrcode_panels, heading="QR Code", classname="qr-code"),
]
)
base_form_class = QrCodeEmailForm
```
This will add a new tab in the page editor `QR Code` where you can preview the generated QR code and access the downloadable print ready EPS file. (the file can also be found in the documents app)
### If you don't need to be able to send the qrcode via email your page model can be
```python
# models.py
from wagtail.admin.panels import (
FieldPanel,
MultiFieldPanel,
ObjectList,
TabbedInterface,
)
from wagtail.models import Page
from wagtail_qrcode.models import QRCodeMixin
class QRCodePage(QRCodeMixin, Page):
qrcode_panels = QRCodeMixin.panels
edit_handler = TabbedInterface(
[
ObjectList(Page.content_panels, heading="Content"),
ObjectList(Page.promote_panels, heading="Promote"),
ObjectList(Page.settings_panels, heading="Settings", classname="settings"),
ObjectList(qrcode_panels, heading="QR Code", classname="qr-code"),
]
)
```
## URLS
Include the wagtail-qrcode urls in your site urls before `wagtail_urls`.
The url provides the redirect endpoint when the qr-code is scanned and viewed in a browser.
```python
urlpatterns = [
# ...
path("qr-code/", include("wagtail_qrcode.urls")),
# ...
]
```
or import the view and pass the view in the path function
```python
from wagtail_qrcode.views import qr_code_page_view
urlpatterns = [
# ...
path("qr-code/", qr_code_page_view, name="qr-code-view"),
# ...
]
```
## Configuration
Set the configuration (optional, these are the defaults)
```python
WAGTAIL_QR_CODE = {
"collection_name": "QR Codes",
"scale": 3,
"quiet_zone": 6,
"svg_has_xml_declaration": False,
"svg_has_doc_type_declaration": False,
}
```
- collection_name: is automatically created and used as the collection for all generated QR codes
- scale: the size of the dots in the QR code
- quiet_zone: the plain border around the QR code
- svg_has_xml_declaration: does the QR code SVG have an XML declaration
- svg_has_doc_type_declaration: does the QR code SVG have an HTML doc-type
## Contributing
If you would like to suggest an improvement to the package [contributions](docs/contrubute.md) are welcome
## Issues
If you find an issue please consider [raising and issue](https://github.com/nickmoreton/wagtail-qrcode/issues)
Raw data
{
"_id": null,
"home_page": null,
"name": "wagtail-qrcode",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "wagtail, qrcode",
"author": null,
"author_email": "Nick Moreton <nickmoreton@me.com>",
"download_url": "https://files.pythonhosted.org/packages/2a/66/609af0e12b3dc72832220e8a1d71f669e18433b55c2350931a416122eb58/wagtail_qrcode-2.1.0.tar.gz",
"platform": null,
"description": "# Wagtail QR code\n\nThis package can be used to create a page in Wagtail CMS that has a corresponding QR Code.\n\n![Alt text](docs/sample.png?raw=true \"Title\")\n\n## Features\n\n- The generated QR Code is saved as an EPS document that can be printed. When scanned IT will link to the page via a redirect using the page ID\n- You can download the generated QR code and use it in printed advertising like posters, postcards, banners, beer mats and more.\n- When saving a draft or publishing a page you can add a one-time email address to send the qr-code to as an attachment.\n\n## Installation\n\nTo add the package to your own Wagtail CMS\n\n**Install the package into your environment.**\n\n```bash\npip install wagtail-qrcode\n```\n\n**Add the package to your site settings.**\n\n```python\nINSTALLED_APPS = [\n # ...\n \"wagtail_qrcode\",\n # ...\n]\n```\n\n**Add this setting to your Wagtail settings.**\n\nIt is used to generate the base url for the QR code\n\n```python\nWAGTAIL_QR_CODE_BASE_URL = \"your-site-url\"\n```\n\nYou'll likely want to test the QRcode using another device. Your device will need to be able to resolve your testing domain and localhost probably won't work.\n\nTry using a service like [ngrok](https://ngrok.com/) to set up a url to your localhost and use that domain name as in the `WAGTAIL_QR_CODE_BASE_URL` setting.\n\nThis is the command I use to start ngrok.\n\n```bash\n./ngrok http 8000 --scheme=http\n```\n\n## Using the QRCode page model mixin\n\nUse the model mixin in a new or an existing page model.\n\n```python\n# models.py\n\nfrom wagtail.admin.panels import (\n FieldPanel,\n MultiFieldPanel,\n ObjectList,\n TabbedInterface,\n)\nfrom wagtail.models import Page\n\nfrom wagtail_qrcode.admin_forms import QrCodeEmailForm\nfrom wagtail_qrcode.models import QRCodeMixin\n\n\nclass QRCodePage(QRCodeMixin, Page):\n qrcode_panels = QRCodeMixin.panels + [\n MultiFieldPanel(\n [\n FieldPanel(\"email_address\"),\n FieldPanel(\"email_subject\"),\n FieldPanel(\"email_body\"),\n ],\n heading=\"Send QR code via email\",\n )\n ]\n\n edit_handler = TabbedInterface(\n [\n ObjectList(Page.content_panels, heading=\"Content\"),\n ObjectList(Page.promote_panels, heading=\"Promote\"),\n ObjectList(Page.settings_panels, heading=\"Settings\", classname=\"settings\"),\n ObjectList(qrcode_panels, heading=\"QR Code\", classname=\"qr-code\"),\n ]\n )\n\n base_form_class = QrCodeEmailForm\n```\n\nThis will add a new tab in the page editor `QR Code` where you can preview the generated QR code and access the downloadable print ready EPS file. (the file can also be found in the documents app)\n\n### If you don't need to be able to send the qrcode via email your page model can be\n\n```python\n# models.py\n\nfrom wagtail.admin.panels import (\n FieldPanel,\n MultiFieldPanel,\n ObjectList,\n TabbedInterface,\n)\nfrom wagtail.models import Page\n\nfrom wagtail_qrcode.models import QRCodeMixin\n\n\nclass QRCodePage(QRCodeMixin, Page):\n qrcode_panels = QRCodeMixin.panels\n\n edit_handler = TabbedInterface(\n [\n ObjectList(Page.content_panels, heading=\"Content\"),\n ObjectList(Page.promote_panels, heading=\"Promote\"),\n ObjectList(Page.settings_panels, heading=\"Settings\", classname=\"settings\"),\n ObjectList(qrcode_panels, heading=\"QR Code\", classname=\"qr-code\"),\n ]\n )\n```\n\n## URLS\n\nInclude the wagtail-qrcode urls in your site urls before `wagtail_urls`.\n\nThe url provides the redirect endpoint when the qr-code is scanned and viewed in a browser.\n\n```python\nurlpatterns = [\n # ...\n path(\"qr-code/\", include(\"wagtail_qrcode.urls\")),\n # ...\n]\n```\n\nor import the view and pass the view in the path function\n\n```python\nfrom wagtail_qrcode.views import qr_code_page_view\n\nurlpatterns = [\n # ...\n path(\"qr-code/\", qr_code_page_view, name=\"qr-code-view\"),\n # ...\n]\n```\n\n## Configuration\n\nSet the configuration (optional, these are the defaults)\n\n```python\nWAGTAIL_QR_CODE = {\n \"collection_name\": \"QR Codes\",\n \"scale\": 3,\n \"quiet_zone\": 6,\n \"svg_has_xml_declaration\": False,\n \"svg_has_doc_type_declaration\": False,\n}\n```\n\n- collection_name: is automatically created and used as the collection for all generated QR codes\n- scale: the size of the dots in the QR code\n- quiet_zone: the plain border around the QR code\n- svg_has_xml_declaration: does the QR code SVG have an XML declaration\n- svg_has_doc_type_declaration: does the QR code SVG have an HTML doc-type\n\n## Contributing\n\nIf you would like to suggest an improvement to the package [contributions](docs/contrubute.md) are welcome\n\n## Issues\n\nIf you find an issue please consider [raising and issue](https://github.com/nickmoreton/wagtail-qrcode/issues)\n",
"bugtrack_url": null,
"license": " MIT License Copyright (c) 2022, Nick Moreton Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "Create a QR code that can be used to link to a wagtail page",
"version": "2.1.0",
"project_urls": {
"Changelog": "https://github.com/wagtail-packages/wagtail-qrcode/blob/release/CHANGELOG.md",
"Issues": "https://github.com/wagtail-packages/wagtail-qrcode/issues",
"Repository": "https://github.com/wagtail-packages/wagtail-qrcode"
},
"split_keywords": [
"wagtail",
" qrcode"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5b3014f522fc5a1d7e01e334cf4f3ee811423fe2e302d972366c6f2ba00f2e59",
"md5": "61ed56dac1eeb69ec288f093c4e813e1",
"sha256": "10159c8bc3d5a5289a27e26e8d534893db441741d911d6595a41fe224c657789"
},
"downloads": -1,
"filename": "wagtail_qrcode-2.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "61ed56dac1eeb69ec288f093c4e813e1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 17014,
"upload_time": "2024-07-14T16:03:35",
"upload_time_iso_8601": "2024-07-14T16:03:35.296661Z",
"url": "https://files.pythonhosted.org/packages/5b/30/14f522fc5a1d7e01e334cf4f3ee811423fe2e302d972366c6f2ba00f2e59/wagtail_qrcode-2.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2a66609af0e12b3dc72832220e8a1d71f669e18433b55c2350931a416122eb58",
"md5": "0cc6d7f3b4aa5355bb79930683a0e010",
"sha256": "9b5dfac825d6fd9ee0c0268d28a3251758b7adb4a9c51f672d707ea8784910ce"
},
"downloads": -1,
"filename": "wagtail_qrcode-2.1.0.tar.gz",
"has_sig": false,
"md5_digest": "0cc6d7f3b4aa5355bb79930683a0e010",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 15816,
"upload_time": "2024-07-14T16:03:36",
"upload_time_iso_8601": "2024-07-14T16:03:36.949959Z",
"url": "https://files.pythonhosted.org/packages/2a/66/609af0e12b3dc72832220e8a1d71f669e18433b55c2350931a416122eb58/wagtail_qrcode-2.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-14 16:03:36",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "wagtail-packages",
"github_project": "wagtail-qrcode",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"tox": true,
"lcname": "wagtail-qrcode"
}