old_contents: from django.db import models
  
  
  class TriggerManager(models.Manager):
      """A simple manager for the Trigger model. This class adds a few convenience
      methods to the regular api:
  
      * custom() -- the set of Triggers that are associated with a user
      * default() -- the set of default Triggers (not associated with a user)
      * for_user(user) -- returns all the triggers for a specific user.
  
      """
  
      def custom(self, **kwargs):
          """Returns the set of *custom* triggers; i.e. those that are associated
          with a User."""
          if 'user' not in kwargs:
              kwargs.update({'user__isnull': False})
          return self.get_queryset().filter(**kwargs)
  
      def default(self, **kwargs):
          """Returns the set of *default* triggers; i.e. those not associated
          with a User."""
          kwargs.update({'user': None})
          return self.get_queryset().filter(**kwargs)
  
      def for_user(self, user):
          """Allow queries like:
  
          Trigger.objects.for_user(some_user)
  
          """
          return self.get_queryset().filter(user=user)
  
      def create_for_user(self, user, name, time, rrule):
          """Creates a time-type trigger based on the given RRule data."""
          return self.create(
              user=user,
              name=name,
              trigger_type="time",
              recurrences=rrule,
          )
  
  class WorkflowManager(models.Manager):
      """A simple model manager for those models that include a workflow
      `state` field. This adds a convenience method for querying published
      objects.
  
      """
  
      def published(self, *args, **kwargs):
          return self.get_queryset().filter(state='published')
  
new_contents: from django.db import models
  
  
  class TriggerManager(models.Manager):
      """A simple manager for the Trigger model. This class adds a few convenience
      methods to the regular api:
  
      * custom() -- the set of Triggers that are associated with a user
      * default() -- the set of default Triggers (not associated with a user)
      * for_user(user) -- returns all the triggers for a specific user.
  
      """
  
      def custom(self, **kwargs):
          """Returns the set of *custom* triggers; i.e. those that are associated
          with a User."""
          if 'user' not in kwargs:
              kwargs.update({'user__isnull': False})
          return self.get_queryset().filter(**kwargs)
  
      def default(self, **kwargs):
          """Returns the set of *default* triggers; i.e. those not associated
          with a User."""
          kwargs.update({'user': None})
          return self.get_queryset().filter(**kwargs)
  
      def for_user(self, user):
          """Allow queries like:
  
          Trigger.objects.for_user(some_user)
  
          """
          return self.get_queryset().filter(user=user)
  
      def create_for_user(self, user, name, time, rrule):
          """Creates a time-type trigger based on the given RRule data."""
          return self.create(
              user=user,
              name=name,
              trigger_type="time",
              time=time,
              recurrences=rrule,
          )
  
  class WorkflowManager(models.Manager):
      """A simple model manager for those models that include a workflow
      `state` field. This adds a convenience method for querying published
      objects.
  
      """
  
      def published(self, *args, **kwargs):
          return self.get_queryset().filter(state='published')
  
subject: fix for missing parameter