Reputation:
I am developing an application designed for a secretary to use. She has a stack of hundreds of ballot forms which have a number of questions on them, and wishes to input this data into a program to show the total votes for each answer. Each question has a number of answers. For example:
Q: "Re-elect current president of the board" A: Choice between "Yes" or "No" or "Neutral"
Year on year the questions can change, as well as the answers, but the current application used in the company is hard coded with the questions and answers of last year.
My aim is to create an app (in Django/Python) which allows the secretary to add/delete questions and answers as she wishes. I am relatively new to Django... I have created an app in University and know how to create basic models and implement the Twitter bootstrap for the GUI.
But I'm a little confused about how to enable the secretary to add custom fields in (which are obviously defined in SQL). Does anyone have any small tips on how to get started? By the way, I recognize that this could be achievable using the admin part of website and would welcome any suggestions about that.
Thank you.
Upvotes: 0
Views: 82
Reputation: 527173
You really don't want to implement each question/answer as a separate DB field.
Instead, make a table of questions and a table of answers, and have a field in the answers table (in general, a ForeignKey
) to indicate which question a given answer is associated with.
Upvotes: 5