私はそれが私のテンプレートdjango ormで別にする方法は?
<table>
{% for bulanmaxs in cekbulan %}
<tr>
<td>{{ bulanmaxs.month }}</td>
</tr>
{% endfor %}
</table>
ですが、それは明確な値に動作しませんでした、それはまだすべての日付を一覧表示する「月」
cekbulan = Transaksi.objects.filter(tanggal__range=["2016-07-01", "2017-06-30"], unit='03').extra(
select={'month': "month(date)"}).distinct()
を表示するには、このクエリからdistintを選択します私のデータベースから、それを解決する方法? PostgreSQLのオン
注釈(ドキュメントの日付注釈)のドキュメントを参照してください。 –
私はannotateが別の@AndreyShipilovのサポートではないと思う – Gusan
distinct = trueをパラメータとして追加できます。 distinct()についても読んでください。おそらく理解に役立つでしょう。 –