2👍
Not answering your question, but you can query customers like this:
from django.db.models import Q
Customer.objects.filter(
Q(subscription__start__lt=current_date),
Q(subscription__end=None) | Q (subscription__end__gt=current_date)
).distinct()
👤vsd
0👍
In answer to the original question, one can use the QuerySet.extra()
method to add raw SQL as explained in the docs
- [Answered ]-Django migrate foreignkey with int index set to 10 digits not 11
- [Answered ]-NameError: name 'static_url' is not defined
- [Answered ]-Django classbased view not accepting view_args and view_kwargs
- [Answered ]-Seemingly quick filter field-lookup is slow
- [Answered ]-System check identified 3 issues (0 silenced)
Source:stackexchange.com