1
我有類models.py:Django的tastypie過濾器布爾字段
class Companies(models.Model):
id = models.AutoField(unique=True, primary_key=True, null=False, blank=False)
is_active = models.BooleanField(default=1, editable=False)
在HTML模板中有這樣的RadioGroup中:使用jQuery我想要序列()RadioGroup中,發送給tastypie
<fieldset>
<legend>Status</legend>
<input type="radio" name="is_active" value="">All</label>
<input type="radio" name="is_active" value="True" checked="1">Active</label>
<input type="radio" name="is_active" value="False">Not Active</label>
</fieldset>
API以從模型中獲得過濾數據:
查詢的URL然後將如下所示:
http://localhost:8000/api/view/company/list/?is_active=
結果將會顯示在IS_ACTIVE場
如果我使用假值僅排?IS_ACTIVE = 1個結果將只有真
我怎樣才能既真和假表表中的行?
我可以在輸入中更改「名稱」屬性,但名稱在所有輸入中必須保持相同。
thx很多,它的工作原理! –