On Wed, Jan 19, 2011 at 5:05 PM, balu <[email protected]> wrote:
> Respected sir
>
> I'm working to create an Online examination system using django. In
> that concept there will be Question bank from which the Questions will
> be created. I'm trying to implement this but I cannot access the
> subclass - "Question" inside the "QuestionBank" class.
>
> class QuestionBank(models.Model):
>
>    subject=models.CharField(max_length=30)
>
>    class Question():
>
>        def __init__(self):
>
>            question = models.CharField(max_length = 500)
>            option_1 = models.CharField(max_length = 100)
>            option_2 = models.CharField(max_length = 100)
>            option_3 = models.CharField(max_length = 100)
>            option_4 = models.CharField(max_length = 100)
>
>            answer = models.CharField(max_length = 100)
>
> Please letme know how to access the inner class through "Admin"
> interface.
>
> Looking forward to your reply
>

Django model classes don't work like that. Explain what relationship
you want between Question and QuestionBank - I imagine a QuestionBank
object has many Question objects? In which case you want two separate
classes, with Question having a ForeignKey field pointing at
QuestionBank.

See the docs for more information:

http://docs.djangoproject.com/en/1.2/ref/models/fields/#foreignkey

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to