no no you are not missing anything. You got it right and I did that in view and it worked. Actually I am new to Django. Thanks a lot.
On Wed, May 7, 2014 at 8:28 PM, Rafael E. Ferrero <[email protected]>wrote: > You are using Ques for related Subject and QuestionBank... just make a > method in Ques class who filter the Ques model with some subject parameter > or do it in your view like: > qs = Ques.objects.select_related().filter(subject='some_name') > > > I'm missing something really big? or i miss understud your question? > > > > 2014-05-07 11:19 GMT-03:00 Anushree Jangid <[email protected]>: > >> No* I start with subject model. *There I have created subjects like >> General knowledge, English etc. Then I create question banks Like for >> General knowledge I have created GK1, GK2 and GK3 . Then when I enter a >> ques in the Ques model there I specify that the question is related to >> which subject and which question bank. >> For e.g In Ques model I enter >> content=what is friction >> subject=General knowledge >> ques_bank=GK1 >> >> >> Now for eg I want to know the question banks associated with subject >> General knowledge, then it should tell GK1 GK2 and GK3 >> Assume all the questions related to the subjects along with their >> question banks have been stored in Ques model. >> >> >> On Wed, May 7, 2014 at 7:38 PM, Davide Scatto <[email protected]>wrote: >> >>> Do you start from Ques model? What are your starting data? >>> >>> Il giorno mercoledì 7 maggio 2014 15:24:38 UTC+2, Anushree ha scritto: >>> >>>> I have the following models. I want to retrieve list of question banks >>>> related to a particular subject. Is it possible to do without modifying the >>>> existing data models?Thank you >>>> class Subject(models.Model): >>>> name = models.CharField(max_length = 255) >>>> desc = models.TextField(blank=True) >>>> def __unicode__(self): >>>> return self.name >>>> >>>> class QuestionBank(models.Model): >>>> name = models.CharField(max_length=255) >>>> desc = models.TextField() >>>> def __unicode__(self): >>>> return self.name >>>> >>>> class Ques(models.Model): >>>> content = models.TextField() >>>> ques_type = models.CharField(max_length = 1 , default= 'A') >>>> score = models.PositiveSmallIntegerField(max_length = 1 , default= 1) >>>> ques_bank = models.ForeignKey(QuestionBank) >>>> subject = models.ForeignKey(Subject) >>>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Django users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To post to this group, send email to [email protected]. >>> Visit this group at http://groups.google.com/group/django-users. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/django-users/f98ca810-27a1-45a2-a177-cef5ba365456%40googlegroups.com<https://groups.google.com/d/msgid/django-users/f98ca810-27a1-45a2-a177-cef5ba365456%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> >> -- >> >> *Anushree Jangid * >> *BIT Mesra, Jaipur Campus* >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/django-users. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/CAP%3D_V50C-VV_zCJK_8%3DgeKb-JeBsZiDgrmLDWu0F6Wmbw_aYFQ%40mail.gmail.com<https://groups.google.com/d/msgid/django-users/CAP%3D_V50C-VV_zCJK_8%3DgeKb-JeBsZiDgrmLDWu0F6Wmbw_aYFQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAJJc_8W9iog17Rtgqp_ywpNkwEovs0jq5g%2B5cx290jVjXvKsWQ%40mail.gmail.com<https://groups.google.com/d/msgid/django-users/CAJJc_8W9iog17Rtgqp_ywpNkwEovs0jq5g%2B5cx290jVjXvKsWQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- *Anushree Jangid* *BIT Mesra, Jaipur Campus* -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAP%3D_V53g09gp0qqHa%2BK%2B%2Bv_5rSq4LOPT6iSi9QFo%2BErDaCnh%3DQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

