0

I would like to modify the tutorial poll that Django provided. I'm interested in varying the question displayed each time the user selects an answer. Specifically, pull questions randomly out from a .txt file, but keep the answer selection the same.

Can I use the model from the tutorial or do I have to create a new one?

ono
  • 2,984
  • 9
  • 43
  • 85

1 Answers1

0

Hi, welcome to SO. You may wish to check this page... How to ask questions on SO - its best to ask a specific rather than general question here and show what you have tried to date.

Having said that this doesn't really sound like a job for django's model classes which are designed so that

Each attribute of the model represents a database field.

Source

You are best to use the existing poll tutorial model, but build a view which takes a text file and loads it into the database. For instance something like this SO post, and this one may get you started.

Community
  • 1
  • 1
will-hart
  • 3,742
  • 2
  • 38
  • 48
  • Thanks. I know how to have a single, stagnant question, but I'm having a hard time generating different questions after a response. I'll dig around the site some more. – ono Sep 05 '12 at 19:48
  • the last link shows hot to get random records... just redirect the user back to poll view showing a random poll – will-hart Sep 05 '12 at 19:49