vyi
vyi

Reputation: 1092

How to create django models Dynamically

My django application need to collect user data(name age country etc) based on his email domain( 'gmail' as in [email protected]).I wist to create a new table every time i encounter a new email domain. Can this be done in django ?

Upvotes: 0

Views: 120

Answers (1)

Ned Batchelder
Ned Batchelder

Reputation: 375584

This is a bad idea. Your tables would all have the same structure. All of your data should be stored in a single table, with a domain column to keep the data separate. Why would you want a different table for each domain? Whatever reason you have, there's a better way to do it.

This idea goes against everything in the design of the relational database, and the Django ORM on top of it.

Upvotes: 1

Related Questions