Re: query on models

2014-05-07 Thread Rafael E. Ferrero
I'll recommend you to read
https://docs.djangoproject.com/en/dev/ref/models/querysets/

Cheers!

--
Rafael E. Ferrero


2014-05-07 12:03 GMT-03:00 Anushree Jangid :

> 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 <
> rafael.ferr...@gmail.com> 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 :
>>
>>> 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 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 django-users+unsubscr...@googlegroups.com.
 To post to this group, send email to django-users@googlegroups.com.
 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
 .

 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 django-users+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> 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
>>> .
>>> 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 django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> 

Re: query on models

2014-05-07 Thread Anushree Jangid
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
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 :
>
>> 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 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 django-users+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> 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
>>> .
>>>
>>> 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 django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> 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
>> .
>> 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> 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
> .
> 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 

Re: query on models

2014-05-07 Thread Rafael E. Ferrero
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 :

> 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 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 django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> 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
>> .
>>
>> 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> 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
> .
> 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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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.
For more options, visit https://groups.google.com/d/optout.


Re: query on models

2014-05-07 Thread Anushree Jangid
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 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> 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
> .
>
> 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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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.
For more options, visit https://groups.google.com/d/optout.


Re: query on models

2014-05-07 Thread Davide Scatto
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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.
For more options, visit https://groups.google.com/d/optout.


Re: query on models

2014-05-07 Thread Rafael E. Ferrero
Just filtering Ques model (imho)

--
Rafael E. Ferrero


2014-05-07 10:24 GMT-03:00 Anushree :

> 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 django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> 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/66442114-cda1-45c4-9320-1059c045e48a%40googlegroups.com
> .
> 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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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_8WPAZcJnfXND1VAdfASK31VuQ1HR1So%3DYykgxcSXEMSxw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


query on models

2014-05-07 Thread Anushree
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/66442114-cda1-45c4-9320-1059c045e48a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Query regarding Models

2012-07-06 Thread Daniel Roseman
On Friday, 6 July 2012 08:53:27 UTC+1, Ashutosh Singh wrote:
>
> I wanted to import to import csv file to the model in django and then 
> after that I wanted to link the csv data to my data of different 
> model.Basically the other data is shapefile which has ids to which I wanna 
> link csv data using those ids.Somebody please help me out its urgent.Plz


Yes. I think the way to solve this problem is to write some code. Do let us 
know how you get on with that.
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/YUB4KLbxargJ.
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 at 
http://groups.google.com/group/django-users?hl=en.



Query regarding Models

2012-07-06 Thread Ashutosh Singh
I wanted to import to import csv file to the model in django and then after 
that I wanted to link the csv data to my data of different model.Basically 
the other data is shapefile which has ids to which I wanna link csv data 
using those ids.Somebody please help me out its urgent.Plz

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/52_qOGghc9UJ.
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 at 
http://groups.google.com/group/django-users?hl=en.