Skip to main content

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

  • 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

  1. Install using pip:
pip install wagtail_translatableforms
  1. 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

  1. To use translatable form in your project import 'TranslatableFormBlock':
from wagtail_translatableforms.blocks import TranslatableFormBlock
  1. 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
  1. To customize translatableform serializer you can import 'TranslatableFormSerializer' and subclass it:
from wagtail_translatableforms.serializers import TranslatableFormSerializer
  1. 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
  1. 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

wagtail_translatableforms-0.1.0.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

wagtail_translatableforms-0.1.0-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

Details for the file wagtail_translatableforms-0.1.0.tar.gz.

File metadata

  • Download URL: wagtail_translatableforms-0.1.0.tar.gz
  • Upload date:
  • Size: 14.5 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

Hashes for wagtail_translatableforms-0.1.0.tar.gz
Algorithm Hash digest
SHA256 afd54d06cb680d6e5af14453dc4f371e33f8eb5c9c954be05a74bf38d2d6b7a8
MD5 d577018fd174e8b9414cf40dca23f9fb
BLAKE2b-256 e3fb092af1470fc179ff89e16b496fbf9b0ca4a170f5267f962b995050ad9818

See more details on using hashes here.

File details

Details for the file wagtail_translatableforms-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for wagtail_translatableforms-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ce242390d515553d4b526742338c25977bca02cd838b79fceb53cdc32c0dec2d
MD5 52dabd87d87386236c5243b21fb1bede
BLAKE2b-256 3a8e7b55147cbc174b4278b2646695bbf85d12dfb7d74e776932f517ba1b6a95

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page