Ability to have users add/edit/remove form fields dynamically?

Hi everyone, I am working on a project that requires a base form + template for every user, based off of a simple model as such…

class FloorPlan(models.Model):
    user = models.ForeignKey(account)
    stories = models.IntegerField()
    bathrooms = models.IntegerField()
    sqft = models.IntegerField()

I know that JS will be needed to make this dynamic.

So every user will have a base form and view, which displays just those 3 fields. Now I also want this form to be customizable in a sense to let the user add any extra fields, or also remove fields that are not used. Maybe they add backyard info, pool info, etc.

I came across this app,

but doesn’t seem to fit what I need.

I was thinking of adding an extra field called extra_field=models.ForeignKey(ExtraField) in the FloorPlan model, and make it a m2m, and in the ExtraField model just store the new fields the user wants to create. But design wise, dont think this would be best to let every user flood the DB?

I’ve been looking around to find maybe a JS library too.

Really just looking for some advice if anyone has created something similar, just looking for some pointers in the right direction.

TY in advance!

The pattern isn’t a many-to-many - there’s no identified need here to have people share “extra data”. But there’s a fairly common pattern called the “Entity-Attribute-Value” model that is about the closest fit to what you describe


class Details(...):
    house = ForeignKey('FloorPlan', ...)
    attribute = CharField(...)
    value = CharField(...)

How detailed you make this is really only limited by your desire to enhance and add features, but you can really make this more sophisticated than presented here.
(For example, one extension I’ve seen used is that the “value” column becomes a JSON object, and so you group multiple related data elements together into a particular attribute. In this case, you might define that an attribute named “room size” must contain the length and width of the room. That attribute itself may be optional with any particular room, but if it exists, you require both values be supplied.)