from django.utils.timezone import now

from django.db import models


class ActiveOfferManager(models.Manager):
    """
    For searching/creating offers within their date range
    """
    def get_query_set(self):
        cutoff = now()
        return super(ActiveOfferManager, self).get_query_set().filter(
            models.Q(end_date__gte=today) | models.Q(end_date=None),
            start_date__lte=today)

from django.utils.timezone import now

from django.db import models


class ActiveOfferManager(models.Manager):
    """
    For searching/creating offers within their date range
    """
    def get_query_set(self):
        cutoff = now()
        return super(ActiveOfferManager, self).get_query_set().filter(
            models.Q(end_datetime__gte=cutoff) | models.Q(end_datetime=None),
            start_datetime__lte=cutoff)

Fix bug in offer manager with new datetimes
Fix bug in offer manager with new datetimes

  from django.utils.timezone import now
  
  from django.db import models
  
  
  class ActiveOfferManager(models.Manager):
      """
      For searching/creating offers within their date range
      """
      def get_query_set(self):
          cutoff = now()
          return super(ActiveOfferManager, self).get_query_set().filter(
-             models.Q(end_date__gte=today) | models.Q(end_date=None),
+             models.Q(end_datetime__gte=cutoff) | models.Q(end_datetime=None),
-             start_date__lte=today)
+             start_datetime__lte=cutoff)
  
Fix bug in offer manager with new datetimes
## Code Before:
from django.utils.timezone import now

from django.db import models


class ActiveOfferManager(models.Manager):
    """
    For searching/creating offers within their date range
    """
    def get_query_set(self):
        cutoff = now()
        return super(ActiveOfferManager, self).get_query_set().filter(
            models.Q(end_date__gte=today) | models.Q(end_date=None),
            start_date__lte=today)

## Instruction:
Fix bug in offer manager with new datetimes
## Code After:
from django.utils.timezone import now

from django.db import models


class ActiveOfferManager(models.Manager):
    """
    For searching/creating offers within their date range
    """
    def get_query_set(self):
        cutoff = now()
        return super(ActiveOfferManager, self).get_query_set().filter(
            models.Q(end_datetime__gte=cutoff) | models.Q(end_datetime=None),
            start_datetime__lte=cutoff)
