Sorry for a newbie question. I have a following model:
class WeightSlip(models.Model):
grossdate = models.DateTimeField(auto_now=False, auto_now_add=False)
Note that if you're using the latest version of django-filter, Filter.method
takes 4 arguments, like so:
def filter_slipdate(self, queryset, name, value):
if value:
queryset = queryset.annotate(slipdate=Case(When(grossdate__gt=F('taredate'), then=F('grossdate')), default=F('taredate')).filter(slipdate=value)
return queryset
```