Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

198
Visualizações
Wagtail Form Builder doesn't support translations?

I am using wagtail translations outlined here for some of my page models. They are working as expected. I am adding a form via the form builder I can access the forms via the url www.domain.com/slug but when I fill it out the url redirects to a None url. Also in the admin, if I click on the LIVE button, it directs to a None url as well.

I assumed it had to do with not being hooked up to the translations because, by default, that is adding a url slug for each language in the promote panel of a page. So I hooked up the form model to the translations and the content panels are getting the correct translations, but the promote panel still only receives a slug field. There is no other fields for the different languages.

The LIVE button still gives a None and when I submit the form on the page, it redirects to a None page with an error. Again, all my other pages that are hooked up with the translations work as expected.

I'm assuming the Wagtail forms don't fully support the translations. With internationalization like this, is it an all or nothing deal? I can't leave the forms outside of the translations situation?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

So after examining the issue more, I had to import Page into the AbstractEmailForm class in order to make it work. This is verbatim what is taken from the Wagtail docs and adding the Page in.

from modelcluster.fields import ParentalKey
from wagtail.wagtailadmin.edit_handlers import (
    FieldPanel, FieldRowPanel,
    InlinePanel, MultiFieldPanel
)
from wagtail.wagtailcore.models import Page
from wagtail.wagtailcore.fields import RichTextField
from wagtail.wagtailforms.models import AbstractEmailForm, AbstractFormField


class FormField(AbstractFormField):
    page = ParentalKey('FormPage', related_name='form_fields')


class FormPage(AbstractEmailForm, Page):
    intro = RichTextField(blank=True)
    thank_you_text = RichTextField(blank=True)

    content_panels = AbstractEmailForm.content_panels + [
        FieldPanel('intro', classname="full"),
        InlinePanel('form_fields', label="Form fields"),
        FieldPanel('thank_you_text', classname="full"),
        MultiFieldPanel([
            FieldRowPanel([
                FieldPanel('from_address', classname="col6"),
                FieldPanel('to_address', classname="col6"),
            ]),
            FieldPanel('subject'),
        ], "Email"),
    ]

Wagtail translations needs to use Page to change the URLS. This fixes the None issue.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda