Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Jan. 19, 2011 17:05:15

b.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Inner classses


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

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Jan. 19, 2011 17:12:54

Tom E.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Inner classses


On Wed, Jan 19, 2011 at 5:05 PM, balu <vab...@gmail.com> 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/#foreignkeyCheers

Tom

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 Jan. 19, 2011 17:24:06

b.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Inner classses


Thank you sir.

On Jan 19, 10:12 pm, Tom Evans <tevans...@googlemail.com> wrote:
> On Wed, Jan 19, 2011 at 5:05 PM, balu <vab...@gmail.com> 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- Hide quoted text -
>
> - Show quoted text -

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

Board footer

Moderator control

Enjoy the 21st of August
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support