Add translatableforms to wagtail projects
Project description
WAGTAIL_TRANSLATABLEFORMS
Wagtail Translatableforms is an additional plagin for Wagtail CMS. It is based on Wagtail Localize, Wagtailstreamforms and Django.
The main idea is to transform wagtailstreamform into translatable wagtail snippet and at the same time maintain wagtailstreamform fuctionality.
Table of Contents
- Requirements
- Installation
- Usage
- License
Requirements
- django = "^4.2.11";
- djangorestframework = ^3.15.0";
- drf_spectacular = "^0.27.1"
- wagtailstreamforms = "^4.1.0"
- wagtail-localize = "^1.8.2"
- wagtail = "^5.2.3"
Installation
- Install using pip:
pip install wagtail_translatableforms
- Add 'wagtail_translatableforms' to your INSTALLED_APPS setting (make sure in goes after: 'django.contrib.admin', 'rest_framework', 'drf_spectacular', 'wagtail_modeladmin', 'wagtail.snippets', 'wagtail', 'wagtail_localize', 'wagtailstreamforms' ):
INSTALLED_APPS = [
# ...
"wagtail_translatableforms",
# ...
]
Usage
- To use translatable form in your project import 'TranslatableFormBlock':
from wagtail_translatableforms.blocks import TranslatableFormBlock
- To make api_represantation if using 'TranslatableFormBlock' in your custom StructBlocks you can import function 'serialize_form' and pass translatableform instance pk and optional a serializer.
from wagtail_translatableforms.serializers import serialize_form
- To customize translatableform serializer you can import 'TranslatableFormSerializer' and subclass it:
from wagtail_translatableforms.serializers import TranslatableFormSerializer
- To customize translatableform import and subclass 'AbstractTranslatableForm':
from wagtail_translatableforms.models import AbstractTranslatableForm
use 'get_translatableform_model' and 'get_translatableform_model_string' to reference model.
from wagtail_translatableforms import get_translatableform_model, get_translatableform_model_string
- Settings.
- WAGTAIL_TRANSLATABLEFORM_FORM_MODEL = 'app.Model' (pass variable only in case of subclassing 'AbstractTranslatableForm');
- WAGTAIL_TRANSLATABLEFORM_SHOW_IP = True/False (add client IP in forms submissions representation, get IP from request.headers["X-Real-Ip"]. Pass Django Request object to 'process_form_submission' in your code. Default to False).
License
This project is licensed under the MIT License.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file wagtail_translatableforms-0.1.1.tar.gz
.
File metadata
- Download URL: wagtail_translatableforms-0.1.1.tar.gz
- Upload date:
- Size: 14.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.6 Linux/6.5.0-35-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87e7c1f7a7e1c503276386d70b3693a632888f068770e45b6203181d96761969 |
|
MD5 | 54d4a551ed4628bad5add5818017712f |
|
BLAKE2b-256 | 2d804de1849a149c7b9ed1fd82a77425c4e8e09423f39e89d1dfa708ee956e5e |
File details
Details for the file wagtail_translatableforms-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: wagtail_translatableforms-0.1.1-py3-none-any.whl
- Upload date:
- Size: 19.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.6 Linux/6.5.0-35-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f2036d014004b1d01b726d44ce4750b399f96e116ff1ed609cb85664364657a |
|
MD5 | 53c00f688ab753b4551b2db3186ecf8e |
|
BLAKE2b-256 | f56207e3136b01a71079d84455b818e6f2c0a1030b987562a433865a62816b58 |