def add_arguments(self, parser): parser.add_argument('file_path', help='Path to the list of IDs. One ID per line.') parser.add_argument('-t', '--doc-type', choices=['form', 'case']) parser.add_argument('--repeater-type', choices=get_all_repeater_types(), help='Only create records for this repeater type') parser.add_argument('--repeater-id', help='Only create records for this repeater') parser.add_argument('--repeater-name', help='Only create records for repeaters whose name matches this regex')
def _get_repeaters(doc): if doc.domain not in by_domain: repeater_class = get_all_repeater_types()[repeater_type] if repeater_type else None repeaters = get_repeaters_for_type_in_domain(doc.domain, repeater_class) if repeater_name_re: repeaters = [r for r in repeaters if repeater_name_re.match(r.name)] if not repeaters: logger.info(f"No repeaters matched for domain '{doc.domain}'") by_domain[doc.domain] = repeaters return by_domain[doc.domain]
def obj_get(self, bundle, **kwargs): return get_object_or_not_exist(Repeater, kwargs['pk'], kwargs['domain'], additional_doc_types=list(get_all_repeater_types()))