コード例 #1
0
 def _apply_updates_to_config(self, config, cleaned_data):
     config.recipient_id = cleaned_data['recipient_id']
     config.schedule = ScheduleConfiguration(
         interval=cleaned_data['schedule_interval'])
     config.template = cleaned_data['template']
     template_variable = TemplateVariable(
         type=cleaned_data['source_type'],
         time_range=cleaned_data['time_range'],
         source_id=cleaned_data['source'],
         app_id=cleaned_data['application'],
     )
     config.template_variables = [template_variable]
     return config
コード例 #2
0
ファイル: test_schedule.py プロジェクト: xbryanc/commcare-hq
def _make_performance_config(domain, interval, hour=DEFAULT_HOUR, day_of_week=DEFAULT_WEEK_DAY,
                             day_of_month=DEFAULT_MONTH_DAY):
    config = PerformanceConfiguration(
        domain=domain,
        recipient_id=uuid.uuid4().hex,
        template='test',
        schedule=ScheduleConfiguration(
            interval=interval,
            hour=hour,
            day_of_week=day_of_week,
            day_of_month=day_of_month,
        )
    )
    config.save()
    return config
コード例 #3
0
 def clean_schedule(self):
     # todo: support other scheduling options
     return ScheduleConfiguration(interval=self.cleaned_data['schedule'])
コード例 #4
0
 def clean_schedule(self):
     return ScheduleConfiguration.wrap(self.cleaned_data['schedule'])