Get a dynamic form based on model columns

Hey there,

I might be wrong from the beginning, but I try to generate a dynamic form.

class Account(models.Model):
    name = models.CharField(max_length=200)
    setup_endpoint = models.CharField(max_length=200, blank=True)
    setup_version = models.IntegerField(default=1)
    option_1 = models.CharField(max_length=200, blank=True)
    option_2 = models.CharField(max_length=200, blank=True)
    option_3 = models.CharField(max_length=200, blank=True)

    def __str__(self):

It was my idea to just query the option_% columns for generating the form.
But I don’t find a option to query account option_.*. Is there a better best practice?

Happy for any hint!

It’s not clear from your description what you’re looking to have in your form, or what you mean by “a dynamic form” in this context.

A normal model form is created either by specifying the fields in the model that you want in the form, or by listing the fields you want excluded from the form.

I think my goal was probably to complicated. I just thought to exclude fields for security reasons. But may i put them just in another table… thanks anyways.