Get the lookup kwargs for filtering on a single date. If the date field is a DateTimeField, we can't just filter on date_field=date because that doesn't take the time into account.
(self, date)
| 280 | return value |
| 281 | |
| 282 | def _make_single_date_lookup(self, date): |
| 283 | """ |
| 284 | Get the lookup kwargs for filtering on a single date. |
| 285 | |
| 286 | If the date field is a DateTimeField, we can't just filter on |
| 287 | date_field=date because that doesn't take the time into account. |
| 288 | """ |
| 289 | date_field = self.get_date_field() |
| 290 | if self.uses_datetime_field: |
| 291 | since = self._make_date_lookup_arg(date) |
| 292 | until = self._make_date_lookup_arg(date + datetime.timedelta(days=1)) |
| 293 | return { |
| 294 | "%s__gte" % date_field: since, |
| 295 | "%s__lt" % date_field: until, |
| 296 | } |
| 297 | else: |
| 298 | # Skip self._make_date_lookup_arg, it's a no-op in this branch. |
| 299 | return {date_field: date} |
| 300 | |
| 301 | |
| 302 | class BaseDateListView(MultipleObjectMixin, DateMixin, View): |
no test coverage detected