I am using the django admin page to put questions into the database.
My models.py is this:
from django.db import models
# Create your models here.
class Question(models.Model):
question_name = models.CharField(max_length=200)
question_type = models.CharField(max_length=20)
def __unicode__(self):
return self.question_name
class PythonQuestion(models.Model):
question_no = models.ForeignKey(Question)
question_text = models.TextField(max_length=1000)
question_testcase = models.TextField(max_length=1000)
question_difflevel = models.CharField(max_length=20)
I want these particular changes to my django-admin page:-
-
As of now, when I am able to add the contents to both the Question model and PythonQuestion model from the admin page. What I want is that I should be able to write into the Question model and then be directed to a page where I can write data into the PythonQuestion model. My pages are up and running; all I need is the directing of links.
-
I want to upload the answers to each questions which are in some file format(Doesn’t matter which format here.Lets assume a text file). How do I do that in the admin page?
Conceptually I think it might be. You can read more about it in the django docs but essentially Django has 3 types of inheritence; abstract, multitable and proxy which are all useful in different situations:
and a quick example (multi table):
You will be able to enter all the data in one go in the django admin (this is the same for both multitable and abstract inheritence). Furthremore, You have an answer attached to every question. These answers can be uploaded via fixtures if needs be (or manually entered through the admin)