How to use a django template variable in django-crispy bootstrap AppendedText or PrependedText?

I saw that a similar question was asked 10 years ago about buttons and that it was resolved. I was naive enough to think that maybe it was possible for other fields ^^ Have I missed something ?

As said in the Title, I'm trying to use a django template variable in a Layout Fieldset AppendedText or PrependedText value, like this

class AddObjectForm(forms.ModelForm):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.layout = Layout(
            Fieldset(
                'Some Text as Legend',
                AppendedText('userref',  ),

but it won't work :-( I also tried with HTML tag like :

                PrependedText('userref', HTML("""""") ),

but in this case I also obtain : <crispy_forms.layout.HTML object at 0x7fb1997f8c70>

Can anyone enlighten me, direct me or confirm that this is not possible?



Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation