0

We have a custom ticket system. For some types of tickets our customer wants to add extra input fields. And the customer wants to add the fields on his own!

Our customer has not source code access (and does not want it). He wants to use an admin interface.

Adding new fields and new models in django needs a corresponding models.py file.

I think it is broken by design if my application parses and creates models.py files.

I see two solutions:

Solution1: One big table for every datatype (no new tables/colums)

Every datatype (text, date, integer, ...) I create a table which stores the data. If the customer wants to add a date-field to all tickets of type "foo", I store the values in the table/model datatypes_date. The benefit: I don't need to create or alter the database schema. The drawback: All (in this example) dates are stored in one table, although they don't fit together (ticket-type "foo" needs a due-date, ticket-type "bar" needs a valid-until-date.).

Solution2: Create tables

I could use south like a library and add tables and columns if the customer wants additional fields for a ticket type.

I can understand the need of the customer, but with django I don't see an easy way to solve this.

How could this be solved?

guettli
  • 25,042
  • 81
  • 346
  • 663
  • 2
    Take a look at this answer: http://stackoverflow.com/questions/18369556/django-web-store-model-organization/18372794#18372794 -- the part that says "Dynamic Item Types" and also this question http://stackoverflow.com/questions/7933596/django-dynamic-model-fields/ – Serafeim Jan 07 '14 at 09:48
  • @Serafeim thank you very much for the link to http://stackoverflow.com/questions/7933596/django-dynamic-model-fields/. I voted to close my own question, since the referenced answer solves my question. – guettli Jan 08 '14 at 15:57

0 Answers0