我在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.id
和remaining < 100
的数据。
尝试使用:
Queue.objects.filter(user_id=request.user.id, remaining < 100) But didn't work.
答案 0 :(得分:1)
Queue.objects.filter(user_id=request.user.id, remaining__lt=100).exclude(remaining=0)