0

I am creating one site in django, there on an HTML page if someone wants to create a new model table then there will be an option like:

model name: MyNewModel  
model fields: {
    username = models.CharField(db_index=True, max_length=255, unique=True),
    email = models.EmailField(db_index=True, unique=True),
    name = models.CharField(db_index=True, max_length=255, null=True, blank=True),
    paid_amount = models.FloatField(max_length=10, blank=False, null=False, default=0)
}

And I want to hit the submit button then this model should add-in my Database. Is there any way to handle this problem? or every time we have to write manually model in our app.

  • duplicate of (https://stackoverflow.com/questions/31835362/using-dynamic-models-in-django-framework) ? – YosSaL Jun 27 '20 at 19:33

1 Answers1

0

You have the option of creating a ModelForm. See the django documentation.

martin
  • 887
  • 7
  • 23