def get_info(self, role=ROLE_TODO): ret = {'attr': []} if TaskGroup.objects.filter(task=self.id, role=role).exists(): ret['group'] = TaskGroup.objects.filter(task=self.id, role=role).get().group.name if self.in_my_day: ret['attr'].append({'myday': True}) step_total = 0 step_completed = 0 for step in Step.objects.filter(task=self.id): step_total += 1 if step.completed: step_completed += 1 if (step_total > 0): if (len(ret['attr']) > 0): ret['attr'].append({'icon': 'separator'}) ret['attr'].append({'text': '{} {} {}'.format(step_completed, _('out of'), step_total)}) if self.stop: ret['attr'].append({'termin': True}) links = len(Urls.objects.filter(task=self.id)) > 0 files = (len(self.get_files_list(APP_TODO, role)) > 0) if (self.remind != None) or self.info or links or files: if (len(ret['attr']) > 0): ret['attr'].append({'icon': 'separator'}) if (self.remind != None): ret['attr'].append({'icon': 'remind'}) if links: ret['attr'].append({'icon': 'url'}) if files: ret['attr'].append({'icon': 'attach'}) if self.info: info_descr = self.info[:80] if len(self.info) > 80: info_descr += '...' ret['attr'].append({'icon': 'notes', 'text': info_descr}) if self.categories: if (len(ret['attr']) > 0): ret['attr'].append({'icon': 'separator'}) categs = get_categories_list(self.categories) for categ in categs: ret['attr'].append({'icon': 'category', 'text': categ.name, 'color': 'category-design-' + categ.design}) if self.completed: if (len(ret['attr']) > 0): ret['attr'].append({'icon': 'separator'}) ret['attr'].append({'text': '{}: {}'.format(_('completion').capitalize(), self.completion.strftime('%d.%m.%Y') if self.completion else '')}) return ret
def get_info(item): attr = [] if item.part_chg_km: attr.append({'text': '{} {}'.format(item.part_chg_km, _('km'))}) if item.part_chg_mo: if (len(attr) > 0): attr.append({'icon': 'separator'}) attr.append({'text': month_declination(item.part_chg_mo)}) rest, color = get_rest(item) if rest: if (len(attr) > 0): attr.append({'icon': 'separator'}) attr.append({'text': rest, 'color': 'rest-color-' + color}) links = len(Urls.objects.filter(task=item.id)) > 0 files = (len(item.get_files_list(app, role)) > 0) if item.info or links or files: if (len(attr) > 0): attr.append({'icon': 'separator'}) if links: attr.append({'icon': 'url'}) if files: attr.append({'icon': 'attach'}) if item.info: info_descr = item.info[:80] if len(item.info) > 80: info_descr += '...' attr.append({'icon': 'notes', 'text': info_descr}) if item.categories: if (len(attr) > 0): attr.append({'icon': 'separator'}) categs = get_categories_list(item.categories) for categ in categs: attr.append({ 'icon': 'category', 'text': categ.name, 'color': 'category-design-' + categ.design }) ret = {'attr': attr} return ret
def get_info(item): ret = {'attr': []} if TaskGroup.objects.filter(task=item.id, role=role).exists(): ret['group'] = TaskGroup.objects.filter(task=item.id, role=role).get().group.name ret['attr'].append({ 'text': '{} {}'.format(item.store_username, '*' * len(item.store_value)) }) hist = Hist.objects.filter(task=item.id) if hist: ret['attr'].append({'icon': 'separator'}) ret['attr'].append({'text': '[{}]'.format(len(hist))}) links = len(Urls.objects.filter(task=item.id)) > 0 files = (len(item.get_files_list(app, role)) > 0) if item.info or links or files: if links: ret['attr'].append({'icon': 'url'}) if files: ret['attr'].append({'icon': 'attach'}) if item.info: info_descr = item.info[:80] if len(item.info) > 80: info_descr += '...' ret['attr'].append({'icon': 'notes', 'text': info_descr}) if item.categories: if (len(ret['attr']) > 0): ret['attr'].append({'icon': 'separator'}) categs = get_categories_list(item.categories) for categ in categs: ret['attr'].append({ 'icon': 'category', 'text': categ.name, 'color': 'category-design-' + categ.design }) return ret
def get_info(item): attr = [] attr.append({'text': _('odometr: ') + '{:,}'.format(item.car_odometr)}) if item.repl_manuf: attr.append({'icon': 'separator'}) attr.append({'text': item.repl_manuf}) if item.repl_part_num: attr.append({'icon': 'separator'}) attr.append({'text': item.repl_part_num}) if item.repl_descr: attr.append({'icon': 'separator'}) attr.append({'text': item.repl_descr}) links = len(Urls.objects.filter(task=item.id)) > 0 files = (len(item.get_files_list(app, role)) > 0) if item.info or links or files: if (len(attr) > 0): attr.append({'icon': 'separator'}) if links: attr.append({'icon': 'url'}) if files: attr.append({'icon': 'attach'}) if item.info: info_descr = item.info[:80] if len(item.info) > 80: info_descr += '...' attr.append({'icon': 'notes', 'text': info_descr}) if item.categories: if (len(attr) > 0): attr.append({'icon': 'separator'}) categs = get_categories_list(item.categories) for categ in categs: attr.append({ 'icon': 'category', 'text': categ.name, 'color': 'category-design-' + categ.design }) ret = {'attr': attr} return ret
def get_info(item): attr = [] links = len(Urls.objects.filter(task=item.id)) > 0 files = (len(item.get_files_list(app, role)) > 0) if item.info or links or files: if (len(attr) > 0): attr.append({'icon': 'separator'}) if links: attr.append({'icon': 'url'}) if files: attr.append({'icon': 'attach'}) if item.info: info_descr = item.info[:80] if len(item.info) > 80: info_descr += '...' attr.append({'icon': 'notes', 'text': info_descr}) if item.categories: if (len(attr) > 0): attr.append({'icon': 'separator'}) categs = get_categories_list(item.categories) for categ in categs: attr.append({ 'icon': 'category', 'text': categ.name, 'color': 'category-design-' + categ.design }) ret = {'attr': attr} ret['attr'].append({'termin': True}) if TaskGroup.objects.filter(task=item.id, role=role).exists(): ret['group'] = TaskGroup.objects.filter(task=item.id, role=role).get().group.name return ret
def get_info(item): attr = [] if item.start: attr.append({'text': '{} {}'.format(_('from'), item.start.strftime('%d.%m.%Y'))}) if item.stop: attr.append({'text': '{} {}'.format(_('to'), item.stop.strftime('%d.%m.%Y'))}) if item.diagnosis: attr.append({'text': item.diagnosis}) links = len(Urls.objects.filter(task=item.id)) > 0 files = (len(item.get_files_list(app, role)) > 0) if item.info or links or files: if (len(attr) > 0): attr.append({'icon': 'separator'}) if links: attr.append({'icon': 'url'}) if files: attr.append({'icon': 'attach'}) if item.info: info_descr = item.info[:80] if len(item.info) > 80: info_descr += '...' attr.append({'icon': 'notes', 'text': info_descr}) if item.categories: if (len(attr) > 0): attr.append({'icon': 'separator'}) categs = get_categories_list(item.categories) for categ in categs: attr.append({'icon': 'category', 'text': categ.name, 'color': 'category-design-' + categ.design}) ret = {'attr': attr} return ret
def get_context(self, name, value, attrs): context = super().get_context(name, value, attrs) context['categories'] = get_categories_list(value) value = '' return context