当前位置: 首页>>代码示例>>Python>>正文


Python Task.is_available_filter方法代码示例

本文整理汇总了Python中oneanddone.tasks.models.Task.is_available_filter方法的典型用法代码示例。如果您正苦于以下问题:Python Task.is_available_filter方法的具体用法?Python Task.is_available_filter怎么用?Python Task.is_available_filter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在oneanddone.tasks.models.Task的用法示例。


在下文中一共展示了Task.is_available_filter方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_is_available_filter_after_end_date

# 需要导入模块: from oneanddone.tasks.models import Task [as 别名]
# 或者: from oneanddone.tasks.models.Task import is_available_filter [as 别名]
 def test_is_available_filter_after_end_date(self):
     """
     If it is after a task's end date, the task should not be
     available.
     """
     tasks = Task.objects.filter(Task.is_available_filter(now=aware_datetime(2014, 2, 1)))
     ok_(self.task_end_jan not in tasks)
开发者ID:akatsoulas,项目名称:oneanddone,代码行数:9,代码来源:test_models.py

示例2: test_is_available_filter_in_range

# 需要导入模块: from oneanddone.tasks.models import Task [as 别名]
# 或者: from oneanddone.tasks.models.Task import is_available_filter [as 别名]
 def test_is_available_filter_in_range(self):
     """
     If the current date is within a task's date range, the task
     should be available.
     """
     tasks = Task.objects.filter(Task.is_available_filter(now=aware_datetime(2014, 1, 5)))
     ok_(self.task_range_jan_feb in tasks)
开发者ID:akatsoulas,项目名称:oneanddone,代码行数:9,代码来源:test_models.py

示例3: test_is_available_filter_after_start_date

# 需要导入模块: from oneanddone.tasks.models import Task [as 别名]
# 或者: from oneanddone.tasks.models.Task import is_available_filter [as 别名]
 def test_is_available_filter_after_start_date(self):
     """
     If it is after a task's start date, the task should be
     available.
     """
     tasks = Task.objects.filter(Task.is_available_filter(now=aware_datetime(2014, 2, 1)))
     ok_(self.task_start_jan in tasks)
开发者ID:akatsoulas,项目名称:oneanddone,代码行数:9,代码来源:test_models.py

示例4: test_is_available_filter_before_start_date

# 需要导入模块: from oneanddone.tasks.models import Task [as 别名]
# 或者: from oneanddone.tasks.models.Task import is_available_filter [as 别名]
 def test_is_available_filter_before_start_date(self):
     """
     If it is before a task's start date, the task should not be
     available.
     """
     tasks = Task.objects.filter(Task.is_available_filter(now=aware_datetime(2013, 12, 1)))
     ok_(self.task_start_jan not in tasks)
开发者ID:akatsoulas,项目名称:oneanddone,代码行数:9,代码来源:test_models.py

示例5: test_is_available_filter_invalid

# 需要导入模块: from oneanddone.tasks.models import Task [as 别名]
# 或者: from oneanddone.tasks.models.Task import is_available_filter [as 别名]
 def test_is_available_filter_invalid(self):
     """
     If a task is marked as invalid, it should not be available.
     """
     tasks = Task.objects.filter(Task.is_available_filter(now=aware_datetime(2014, 1, 2)))
     ok_(self.task_no_draft in tasks)
     ok_(self.task_invalid not in tasks)
开发者ID:akatsoulas,项目名称:oneanddone,代码行数:9,代码来源:test_models.py

示例6: test_is_available_filter_default_now

# 需要导入模块: from oneanddone.tasks.models import Task [as 别名]
# 或者: from oneanddone.tasks.models.Task import is_available_filter [as 别名]
 def test_is_available_filter_default_now(self):
     """
     If no timezone is given, is_available_filter should use
     timezone.now to determine the current datetime.
     """
     with patch('oneanddone.tasks.models.timezone.now') as now:
         now.return_value = aware_datetime(2014, 1, 5)
         tasks = Task.objects.filter(Task.is_available_filter())
         expected = [self.task_no_draft, self.task_start_jan, self.task_range_jan_feb]
         eq_(set(tasks), set(expected))
开发者ID:kyoshino,项目名称:oneanddone,代码行数:12,代码来源:test_models.py

示例7: __init__

# 需要导入模块: from oneanddone.tasks.models import Task [as 别名]
# 或者: from oneanddone.tasks.models.Task import is_available_filter [as 别名]
    def __init__(self, *args, **kwargs):
        super(AvailableTasksFilterSet, self).__init__(*args, **kwargs)

        # Limit the area filter to TaskAreas that have available tasks.
        available_areas = TaskArea.objects.filter(Task.is_available_filter(prefix='task__')).distinct()
        ancestor_querysets = [area.get_ancestors(include_self=True) for area in available_areas]
        self.filters['area'] = TreeFilter(
            name='area',
            queryset=reduce(operator.or_, ancestor_querysets).distinct(),
            empty_label=u'All Areas'
        )
开发者ID:lizzard,项目名称:oneanddone,代码行数:13,代码来源:filters.py

示例8: test_is_available_filter_default_now

# 需要导入模块: from oneanddone.tasks.models import Task [as 别名]
# 或者: from oneanddone.tasks.models.Task import is_available_filter [as 别名]
 def test_is_available_filter_default_now(self):
     """
     If no timezone is given, is_available_filter should use
     timezone.now to determine the current datetime.
     This also tests the repeatable aspect of the filter by
     ensuring that tasks with attempts that are started or
     finished are not included, but those with no attempts
     or abandoned attempts are included.
     """
     with patch('oneanddone.tasks.models.timezone.now') as now:
         now.return_value = aware_datetime(2014, 1, 5)
         tasks = Task.objects.filter(Task.is_available_filter())
         expected = [self.task_not_repeatable_no_attempts,
                     self.task_not_repeatable_abandoned_attempt,
                     self.task_no_draft, self.task_start_jan,
                     self.task_range_jan_feb]
         eq_(set(tasks), set(expected))
开发者ID:akatsoulas,项目名称:oneanddone,代码行数:19,代码来源:test_models.py

示例9: get_queryset

# 需要导入模块: from oneanddone.tasks.models import Task [as 别名]
# 或者: from oneanddone.tasks.models.Task import is_available_filter [as 别名]
 def get_queryset(self):
     queryset = super(TaskMustBeAvailableMixin, self).get_queryset()
     return queryset.filter(Task.is_available_filter(allow_expired=self.allow_expired_tasks))
开发者ID:adini121,项目名称:oneanddone,代码行数:5,代码来源:mixins.py

示例10: test_is_available_filter_before_end_date

# 需要导入模块: from oneanddone.tasks.models import Task [as 别名]
# 或者: from oneanddone.tasks.models.Task import is_available_filter [as 别名]
 def test_is_available_filter_before_end_date(self):
     """
     If it is before a task's end date, the task should be available.
     """
     tasks = Task.objects.filter(Task.is_available_filter(now=aware_datetime(2013, 12, 1)))
     ok_(self.task_end_jan in tasks)
开发者ID:akatsoulas,项目名称:oneanddone,代码行数:8,代码来源:test_models.py


注:本文中的oneanddone.tasks.models.Task.is_available_filter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。