[Python] fieldsets(legend) in modelform django

Discussão em 'Python' iniciado por Stack, Março 28, 2025.

  1. Stack

    Stack Membro Participativo

    I have a model form

    forms.py

    class (forms.ModelForm):
    class Meta:
    model = InfoPersonal
    fields = [
    'name',
    'phone_number'
    ]


    models.py

    class InfoPersonal(models.Model):
    name = models.CharField(_('Имя'), max_length=50)
    phone_number = PhoneNumberField(
    _('Номер телефона'), max_length=20, unique=True, blank=True, null=True,



    personal_info-add.html

    <form enctype="multipart/form-data"
    action="{% url 'workflows:personal_info-add' user.pk %}" method="post">
    {% include "_parts/form.html" with form=form %}
    </form>



    I want to get the result as shown in the picture( email -> name passord -> tel). Is it possible to add a tag in the module itself?

    I need the <name> and <phone_number> fields to be inside the tag <fieldset> (legend)enter image description here

    how to implement it help please!!!

    Continue reading...

Compartilhe esta Página