mdance
mdance

Reputation: 996

Dynamically add to Django Model

I have need to dynamically (not manually edit models.py) alter/add/remove from a Django Model. Is this possible? Once the model is altered, will it persist? I then want to use South for running the database migration from the altered model.

Upvotes: 0

Views: 113

Answers (1)

Ned Batchelder
Ned Batchelder

Reputation: 375634

It sounds like you want your program to add and delete fields from the model? That sounds like a bad idea. That would imply that your database schema will change dynamically under program control, which would be very unusual indeed. Think harder about what data you need to represent, and come up with a database schema that works for all of your data.

Or, change to a non-SQL database, which means avoiding South altogether.

Upvotes: 3

Related Questions