如何编写一个Djouo查询,其中coloum_value< 100?

时间:2013-02-05 03:52:49

标签: django

我在DJango有一张这样的桌子?

| id | user_id | name          | source         | remaining | start_date                 | time_remaining | size |
+----+---------+---------------+----------------+-----------+----------------------------+----------------+------+
|  1 |       1 | ok.txt        | ngs.pradhi.com |        20 | February 05, 2013, 08:01AM | 1              | 4 MB |
|  2 |       1 | NC_008253.fna | ngs.pradhi.com |        20 | February 05, 2013, 08:02AM | 1              | 4 MB |
|  3 |       1 | test.data     | ngs.pradhi.com |         0 | February 05, 2013, 08:21AM | 1              | 4 MB 

我想检索user_id = request.user.idremaining < 100的数据。 尝试使用:

Queue.objects.filter(user_id=request.user.id, remaining < 100) But didn't work.

1 个答案:

答案 0 :(得分:1)

Queue.objects.filter(user_id=request.user.id, remaining__lt=100).exclude(remaining=0)

Django Field lookups