Monday, December 23, 2013

Re: I can't figure out the django qeryset for retriving a value from a field by a condition


Hi Ali,

The syntax you're looking for is:

MyModel.objects.filter(mobile_name='xyz')

The Django tutorial provides a good explanation of the sorts of features that are available in Django ORM queries.

Yours,
Russ Magee %-)



On Tue, Dec 24, 2013 at 8:27 AM, Ali Hayder <alihayder19@gmail.com> wrote:
HI, 
My model like this 
 
        mobile_name = models.CharField("Mobile Name", max_length=50)
opinion = models.CharField('Comments', max_length=2000)
total = models.FloatField('Total Mark')


the sql qery should like this "SELECT total FROM tablexyz WHERE mobile_name=xyz"

Thanks in advance

--
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+unsubscribe@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/faf3674f-c1c6-41f6-98c6-a01b12d5d6f9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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+unsubscribe@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/CAJxq849FxtQhgPKXW7UecvDcMUL7m89FS2SY%2Bikj-nhg6KvTzQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment