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

204
Visualizações
Bootstrap help-block and Django registration form help_text

I am using the django.contrib.auth registration form and trying to get the help text to display consistently for all fields using Bootstrap.

I am using the following code in my Django template for the help text as part of a for loop on the form:

<p class="help-block">{{ field.help_text }}</p>

This works fine apart from the help text for the password field where it displays with the html tags:

password field help with tags

To prevent this I changed the code above to:

<p class="help-block">{{ field.help_text|safe }}</p>

But now the help text is not being formatted by Bootstrap, I guess because of the html inside the paragraph block.

help-block no longer formatting

Is there an obvious step I'm missing or is there another way this can be done?

Thanks.

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

0

Okay, late answer, but you can override the help text in the form, and make it whatever you want.

For example:

class MyRegistrationForm(RegistrationForm):
    def __init__(self, *args, **kwargs):
        super(MyRegistrationForm, self).__init__(*args, **kwargs)
        self.fields['password'].help_text = 'Password help text with whatever tags you want.'
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