Esempio n. 1
0
class FailedJobTable(JobTable):

    id = tables.Column(verbose_name="ID")
    actions = tables.TemplateColumn(
        template_name="lava_scheduler_app/job_actions_field.html")
    actions.orderable = False
    device = tables.Column(accessor='device_sort')
    duration = tables.Column(accessor='duration_sort')
    duration.orderable = False
    failure_tags = TagsColumn()
    failure_comment = tables.Column()
    submit_time = tables.DateColumn("Nd, g:ia")
    end_time = tables.DateColumn("Nd, g:ia")

    def __init__(self, *args, **kwargs):
        super(FailedJobTable, self).__init__(*args, **kwargs)
        self.length = 10

    class Meta(JobTable.Meta):  # pylint: disable=too-few-public-methods,no-init,no-self-use
        fields = (
            'id', 'actions', 'status', 'device', 'submit_time'
        )
        sequence = (
            'id', 'actions', 'status', 'device', 'submit_time'
        )
        exclude = ('submitter', 'end_time', 'priority', 'description')
Esempio n. 2
0
class QueryTestJobTable(JobTable):

    id = tables.Column(verbose_name="ID")
    actions = tables.TemplateColumn(
        template_name="lava_scheduler_app/job_actions_field.html")
    actions.orderable = False
    device = tables.TemplateColumn("""
    <a href="{{ record.get_absolute_url }}">{{ record.hostname }}</a>
    """)
    device.orderable = False
    duration = tables.Column()
    duration.orderable = False
    submit_time = tables.DateColumn()
    end_time = tables.DateColumn()

    omit = tables.TemplateColumn("""
    <a href="{{ query.get_absolute_url }}/{{ record.id }}/+omit-result" data-toggle="confirm" data-title="Omitting results affects all charts which use this query. Are you sure you want to omit this job from query?"><span class="glyphicon glyphicon-remove"></span></a>
    """)
    omit.orderable = False

    def __init__(self, query, user, *args, **kwargs):
        super().__init__(*args, **kwargs)
        if query and query.is_accessible_by(user):
            self.base_columns["omit"].visible = True
        else:
            self.base_columns["omit"].visible = False

    class Meta(JobTable.Meta):
        model = TestJob
        attrs = {"class": "table table-hover", "id": "query-results-table"}
        per_page_field = "length"
        queries = {}
Esempio n. 3
0
class QueueJobsTable(JobTable):

    id = tables.Column(verbose_name="ID")
    id.orderable = False
    actions = tables.TemplateColumn(
        template_name="lava_scheduler_app/job_actions_field.html")
    actions.orderable = False
    device = tables.Column(accessor='device_sort')
    in_queue = tables.TemplateColumn('''
    for {{ record.submit_time|timesince }}
    ''')
    in_queue.orderable = False
    submit_time = tables.DateColumn("Nd, g:ia")
    end_time = tables.DateColumn("Nd, g:ia")

    def __init__(self, *args, **kwargs):
        super(QueueJobsTable, self).__init__(*args, **kwargs)
        self.length = 50

    class Meta(JobTable.Meta):  # pylint: disable=too-few-public-methods,no-init,no-self-use
        fields = (
            'id', 'actions', 'device', 'description', 'submitter',
            'submit_time', 'in_queue'
        )
        sequence = (
            'id', 'actions', 'device', 'description', 'submitter',
            'submit_time', 'in_queue'
        )
        exclude = ('status', 'priority', 'end_time', 'duration')
Esempio n. 4
0
class CertTable(tables.Table):
    dgst = tables.TemplateColumn(
        '<a href="{% url \'ca:detail_cert\' record.dgst %}">'
        '{{record.dgst}}</a>'
        '  <span class="badge">{{record.signed_count}}</span>')
    issuer = tables.TemplateColumn(
        '{%if record.issuer%}'
        '<a href="{% url \'ca:detail_cert\' record.issuer %}">'
        '{{record.issuer}}</a>{%else%}--{%endif%}')
    key = tables.TemplateColumn(
        '{%if record.key%}'
        '<a href="{% url \'ca:detail_key\' record.key_id %}">'
        '{{record.key_id}}</a>{%else%}--{%endif%}')
    notbefore = tables.DateColumn()
    notafter = tables.DateColumn()
    ops = tables.TemplateColumn(
        '<a href="{% url \'ca:revoke_cert\' record.dgst %}">revoke</a>  '
        '<a href="{% url \'ca:remove_cert\' record.dgst %}">remove</a>')

    class Meta:
        model = Cert
        fields = ('dgst', 'sn', 'cn', 'issuer', 'key', 'ca', 'notbefore',
                  'notafter')
        template_name = 'django_tables2/bootstrap.html'
        attrs = {
            'id': 'cert_list',
            'class': 'table-striped table-condensed table-responsive'
        }
        row_attrs = {
            'class': lambda record: STATUS_COLOR_MAP.get(record.status, ''),
        }
Esempio n. 5
0
class RecentJobsTable(JobTable):

    id = tables.Column(verbose_name="ID")
    id.orderable = False
    device = tables.Column(accessor='device_sort')
    log_level = tables.Column(accessor="definition", verbose_name="Log level")
    duration = tables.Column(accessor='duration_sort')
    duration.orderable = False
    submit_time = tables.DateColumn("Nd, g:ia")
    end_time = tables.DateColumn("Nd, g:ia")

    def __init__(self, *args, **kwargs):
        super(RecentJobsTable, self).__init__(*args, **kwargs)
        self.length = 10

    def render_log_level(self, record):  # pylint: disable=no-self-use
        try:
            data = json.loads(record.definition)
        except ValueError:
            return "debug"
        try:
            data['logging_level']
        except KeyError:
            return ""
        return data['logging_level'].lower()

    class Meta(JobTable.Meta):  # pylint: disable=too-few-public-methods,no-init,no-self-use
        fields = ()
        sequence = ('...', 'log_level')
        exclude = ('device', )
Esempio n. 6
0
class BaseProjectsTable(tables.Table):
    title = tables.LinkColumn(
        'funds:projects:detail',
        text=lambda r: textwrap.shorten(r.title, width=30, placeholder="..."),
        args=[tables.utils.A('pk')],
    )
    status = tables.Column(verbose_name='Status',
                           accessor='get_status_display',
                           order_by=('status', ))
    fund = tables.Column(verbose_name='Fund', accessor='submission.page')
    reporting = tables.Column(verbose_name='Reporting', accessor='pk')
    last_payment_request = tables.DateColumn()
    end_date = tables.DateColumn(verbose_name='End Date',
                                 accessor='proposed_end')
    fund_allocation = tables.Column(verbose_name='Fund Allocation',
                                    accessor='value')

    def render_fund_allocation(self, record):
        return f'${intcomma(record.amount_paid)} / ${intcomma(record.value)}'

    def render_reporting(self, record):
        if not hasattr(record, 'report_config'):
            return '-'

        if record.report_config.is_up_to_date():
            return 'Up to date'

        if record.report_config.has_very_late_reports():
            display = '<svg class="icon"><use xlink:href="#exclamation-point"></use></svg>'
        else:
            display = ''

        display += f'{ record.report_config.outstanding_reports() } outstanding'
        return mark_safe(display)
Esempio n. 7
0
		def get_table_column(field):
			if isinstance(field, models.DateTimeField):
				return tables.DateColumn("m/d/Y H:i")
			elif isinstance(field, models.DateField):
				return tables.DateColumn("m/d/Y")
			else:
				return tables.Column()
Esempio n. 8
0
class SubmissionsTable(tables.Table):
    """Base table for listing submissions, do not include admin data to this table"""
    title = tables.LinkColumn('funds:submissions:detail',
                              text=render_title,
                              args=[A('pk')],
                              orderable=True,
                              attrs={
                                  'td': {
                                      'data-title-tooltip':
                                      lambda record: record.title,
                                      'class': 'js-title'
                                  }
                              })
    submit_time = tables.DateColumn(verbose_name=_('Submitted'))
    phase = tables.Column(
        verbose_name=_('Status'),
        order_by=('status', ),
        attrs={'td': {
            'data-actions': render_actions,
            'class': 'js-actions'
        }})
    stage = tables.Column(verbose_name=_('Type'), order_by=('status', ))
    fund = tables.Column(verbose_name=_('Fund'), accessor='page')
    comments = tables.Column(accessor='comment_count',
                             verbose_name=_('Comments'))
    last_update = tables.DateColumn(accessor="last_update",
                                    verbose_name=_('Last updated'))

    class Meta:
        model = ApplicationSubmission
        order_by = ('-last_update', )
        fields = ('title', 'phase', 'stage', 'fund', 'round', 'submit_time',
                  'last_update')
        sequence = fields + ('comments', )
        template_name = 'funds/tables/table.html'
        row_attrs = {
            'class': make_row_class,
            'data-record-id': lambda record: record.id,
        }
        attrs = {'class': 'all-submissions-table'}
        empty_text = _('No submissions available')

    def render_user(self, value):
        return value.get_full_name()

    def render_phase(self, value):
        return format_html('<span>{}</span>', value)

    def order_last_update(self, qs, desc):
        update_order = getattr(F('last_update'),
                               'desc' if desc else 'asc')(nulls_last=True)

        qs = qs.order_by(update_order, 'submit_time')
        return qs, True

    def get_column_class_names(self, classes_set, bound_column):
        classes_set = super(SubmissionsTable, self).get_column_class_names(
            classes_set, bound_column)
        classes_set.add(bound_column.name)
        return classes_set
Esempio n. 9
0
class RecentJobsTable(JobTable):

    id = tables.Column(verbose_name="ID")
    id.orderable = False
    actions = tables.TemplateColumn(
        template_name="lava_scheduler_app/job_actions_field.html"
    )
    actions.orderable = False
    duration = tables.Column()
    duration.orderable = False
    submit_time = tables.DateColumn("Nd, g:ia")
    end_time = tables.DateColumn("Nd, g:ia")

    class Meta(JobTable.Meta):
        fields = (
            "id",
            "actions",
            "description",
            "submitter",
            "submit_time",
            "end_time",
            "duration",
        )
        sequence = (
            "id",
            "actions",
            "state",
            "description",
            "submitter",
            "submit_time",
            "end_time",
            "duration",
        )
        exclude = ("device", "device_type", "actual_device", "requested_device_type")
Esempio n. 10
0
class OverviewJobsTable(JobTable):

    id = tables.Column(verbose_name="ID")
    id.orderable = False
    actions = tables.TemplateColumn(
        template_name="lava_scheduler_app/job_actions_field.html")
    actions.orderable = False
    device = tables.Column(accessor="actual_device", verbose_name="Device")
    duration = tables.Column()
    duration.orderable = False
    submit_time = tables.DateColumn("Nd, g:ia")
    end_time = tables.DateColumn("Nd, g:ia")

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.length = 10

    class Meta(JobTable.Meta):  # pylint: disable=too-few-public-methods,no-init,no-self-use
        fields = (
            "id",
            "actions",
            "device",
            "description",
            "submitter",
            "submit_time",
            "end_time",
            "duration",
        )
        sequence = ("id", "actions", "device")
        exclude = ("device_type", )
Esempio n. 11
0
class ExpiringConsultancyContractOverviewTable(BaseTable):
    """Expiring consultancy contract overview table."""
    class Meta(BaseTable.Meta):
        pass

    user = tables.LinkColumn(
        viewname='admin:auth_user_change',
        args=[A('user.id')],
        accessor='contract_user',
        order_by=['user.first_name', 'user.last_name', 'user.username'])
    contract = tables.LinkColumn(viewname='admin:ninetofiver_contract_change',
                                 args=[A('contract.id')],
                                 accessor='contract',
                                 order_by=['contract.name'])
    starts_at = tables.DateColumn('D d F', accessor='contract.starts_at')
    ends_at = tables.DateColumn('D d F', accessor='contract.ends_at')
    alotted_hours = SummedHoursColumn(accessor='alotted_hours')
    performed_hours = SummedHoursColumn(accessor='performed_hours')
    remaining_hours = SummedHoursColumn(accessor='remaining_hours')

    # actions = tables.Column(accessor='user', orderable=False, exclude_from_export=True)

    def render_actions(self, record):
        buttons = []

        return format_html('%s' % ('&nbsp;'.join(buttons)))
Esempio n. 12
0
class IndexJobTable(JobTable):

    id = tables.Column(verbose_name="ID")
    actions = tables.TemplateColumn(
        template_name="lava_scheduler_app/job_actions_field.html"
    )
    actions.orderable = False
    submit_time = tables.DateColumn("Nd, g:ia")
    end_time = tables.DateColumn("Nd, g:ia")

    def render_health(self, record):
        if record.health == Device.HEALTH_GOOD:
            return mark_safe(  # nosec - internal data
                '<strong class="text-success">Good</strong>'
            )
        elif record.health in [Device.HEALTH_UNKNOWN, Device.HEALTH_LOOPING]:
            return mark_safe(  # nosec - internal data
                '<span class="text-info">%s</span>' % record.get_health_display()
            )
        elif record.health == Device.HEALTH_BAD:
            return mark_safe(  # nosec - internal data
                '<span class="text-danger">Bad</span>'
            )
        elif record.health == Device.HEALTH_MAINTENANCE:
            return mark_safe(  # nosec - internal data
                '<span class="text-warning">Maintenance</span>'
            )
        else:
            return mark_safe(  # nosec - internal data
                '<span class="text-muted">Retired</span>'
            )

    class Meta(JobTable.Meta):
        fields = (
            "id",
            "actions",
            "state",
            "health",
            "priority",
            "device",
            "device_type",
            "health",
            "description",
            "submitter",
            "submit_time",
        )
        sequence = (
            "id",
            "actions",
            "state",
            "priority",
            "device",
            "device_type",
            "health",
            "description",
            "submitter",
            "submit_time",
        )
        exclude = ("end_time", "duration")
Esempio n. 13
0
class PledgeFormTable(tables.Table):
    pledge = tables.DateColumn(verbose_name="Pledge Date")
    submitted = tables.DateColumn()
    status = tables.Column()
    pledge_names = tables.Column()

    class Meta:
        attrs = {"class": "table table-striped table-bordered"}
Esempio n. 14
0
        class TestTable(tables.Table):
            date = tables.DateColumn(format="D b Y")
            date_linkify = tables.DateColumn(accessor="date",
                                             format="D b Y",
                                             linkify=isoformat_link)

            class Meta:
                default = "—"
Esempio n. 15
0
class DepledgeTable(tables.Table):
    user = tables.Column(accessor="user.name")
    date = tables.DateColumn(verbose_name="Depledge Date")
    created = tables.DateColumn(verbose_name="Submitted")

    class Meta:
        model = Depledge
        fields = ("user", "date", "created")
        attrs = {"class": "table table-striped table-bordered"}
Esempio n. 16
0
class QueueJobsTable(JobTable):

    id = tables.Column(verbose_name="ID")
    id.orderable = False
    actions = tables.TemplateColumn(
        template_name="lava_scheduler_app/job_actions_field.html"
    )

    def render_requested_device_type(self, record):
        return mark_safe(  # nosec - internal data
            '<a href="%s" title="%s device_type">%s</a>'
            % (
                record.requested_device_type.get_absolute_url(),
                record.requested_device_type,
                record.requested_device_type,
            )
        )

    actions.orderable = False
    requested_device_type = tables.Column()
    in_queue = tables.TemplateColumn(
        """
    for {{ record.submit_time|timesince }}
    """
    )
    in_queue.orderable = False
    submit_time = tables.DateColumn("Nd, g:ia")
    end_time = tables.DateColumn("Nd, g:ia")

    class Meta(JobTable.Meta):
        fields = (
            "id",
            "actions",
            "requested_device_type",
            "description",
            "submitter",
            "submit_time",
            "in_queue",
        )
        sequence = (
            "id",
            "actions",
            "requested_device_type",
            "description",
            "submitter",
            "submit_time",
            "in_queue",
        )
        exclude = (
            "state",
            "health",
            "priority",
            "end_time",
            "duration",
            "device_type",
            "device",
        )
Esempio n. 17
0
class StatusChangeTable(tables.Table):
    user = tables.Column(accessor="user.name")
    date_start = tables.DateColumn(verbose_name="Change Date")
    created = tables.DateColumn(verbose_name="Form Submitted")

    class Meta:
        model = StatusChange
        fields = ("user", "date_start", "created", "reason", "date_end")
        attrs = {"class": "table table-striped table-bordered"}
Esempio n. 18
0
class IssueTable(tables.Table):
    created_at = tables.DateColumn()
    status_created_at = tables.DateColumn()
    id = tables.Column(linkify=("office:issue", {"pk": tables.A("pk")}), verbose_name= _('number'))
    category = tables.Column()
    category_type = tables.Column(empty_values=(), verbose_name= _('category type'))
    category_main = tables.Column(empty_values=(), verbose_name= _('main category'))
    category_sub = tables.Column(empty_values=(), verbose_name= _('sub category'))
    status_styled = tables.Column(empty_values=(), verbose_name= _('status'))
    
        
    def render_category_main(self, record):
        issue = record
        return issue.category.parent.name
    
    def render_category_sub(self, value, record):
        issue = record
        return issue.category.name
    
    def render_category_type(self, value, record):
        # TODO: Merge with admin code
        issue = record
        type_text = issue.category.get_root().name
        if type_text == 'Problem':
            return mark_safe('<i class="fa fa-warning" aria-hidden="true" title="{}"></i>'.format(type_text))
        if type_text == 'Idee':
            return mark_safe('<i class="fa fa-lightbulb-o" aria-hidden="true" title="{}"></i>'.format(type_text))
        if type_text == 'Tipp':
            return mark_safe('<i class="fa fa-flash" aria-hidden="true" title="{}"></i>'.format(type_text))
    
    def render_status_styled(self, value, record):
        issue = record
        status_text = issue.get_status_display()
        if issue.status == StatusTypes.SUBMITTED:
            return mark_safe('<i class="fa fa-share text-muted" aria-hidden="true" title="{}"></i>'.format(status_text))
        elif issue.status == StatusTypes.REVIEW:
            return mark_safe('<i class="fa fa-share text-danger" aria-hidden="true" title="{}"></i>'.format(status_text))
        elif issue.status == StatusTypes.WIP:
            return mark_safe('<i class="fa fa-gears text-danger" aria-hidden="true" title="{}"></i>'.format(status_text))
        elif issue.status == StatusTypes.SOLVED:
            return mark_safe('<i class="fa fa-flag-checkered text-success" aria-hidden="true" title="{}"></i>'.format(status_text))
        elif issue.status == StatusTypes.IMPOSSIBLE:
            return mark_safe('<i class="fa fa-flag-checkered text-success" aria-hidden="true" title="{}"></i>'.format(status_text))
        elif issue.status == StatusTypes.DUBLICATE:
            return mark_safe('<i class="fa fa-copy text-muted"" aria-hidden="true" title="{}"></i>'.format(status_text))
    class Meta:
        model = Issue
        template_name = "django_tables2/bootstrap4.html"
        fields = ('id', 'created_at', 'location', 'category_type', 'category_sub', 'priority', 'status_styled','status_created_at', 'published' )
        order_by = ('-id')
        attrs = {
                'class': 'table table-hover',
                'thead' : {
                    'class': 'thead-light'
                }
        }
Esempio n. 19
0
class TaskTable(tables.Table):
    class Meta:
        model = Task
        template_name = 'django_tables2/bootstrap4.html'
        fields = ['pub_date', 'elevator', 'task_text', 'report_text', 'worker', 'fixed', 'fix_date']

    task_text = tables.Column(linkify=("logger:task-update", [tables.A("pk")]))
    pub_date = tables.DateColumn(format='d.m.Y')
    # order_date = tables.DateColumn(format='d.m.Y')
    fix_date = tables.DateColumn(format='d.m.Y')
Esempio n. 20
0
class InitiationTable(tables.Table):
    initiation = tables.DateColumn(verbose_name="Initiation Date")
    submitted = tables.DateColumn()
    status = tables.Column()
    member_names = tables.Column()

    class Meta:
        attrs = {
            "class": "table table-striped table-bordered",
        }
Esempio n. 21
0
class CurrentChallenges(tables.Table):
    challenger = tables.LinkColumn(
        'team',
        args=[A('challenger')],
        verbose_name="Challenger",
        orderable=False,
    )
    challenged = tables.LinkColumn(
        'team',
        args=[A('challenged')],
        verbose_name="Challenged",
        orderable=False,
    )
    map = tables.Column(orderable=False, )
    challenge_date = tables.DateColumn(
        verbose_name="Challenge Date",
        orderable=False,
    )
    forfeit_date = tables.DateColumn(
        verbose_name="Forfeit Date",
        orderable=False,
    )
    void_date = tables.DateColumn(
        verbose_name="Void Date",
        orderable=False,
    )
    id = tables.LinkColumn(
        'submit',
        args=[A('id')],
        verbose_name="",
        orderable=False,
        text=lambda record: 'approve score'
        if record.submitted_by else 'submit score',
        attrs={'a': {
            'class': 'submitScore'
        }},
    )

    class Meta:
        model = Challenge
        exclude = ('played', 'play_date', 'g1_results', 'g2_results', 'winner',
                   'loser', 'approved', 'g1_submitted', 'g2_submitted',
                   'submitted_by')
        sequence = (
            'challenger',
            'challenged',
            'map',
            'challenge_date',
            'forfeit_date',
            'void_date',
            'id',
        )
        attrs = {'class': 'table current'}
Esempio n. 22
0
class OrdersTable(tables.Table):
    date = tables.DateColumn('d.m.Y', verbose_name='Дата')
    deadline = tables.DateColumn('d.m.Y', verbose_name='Срок сдачи')
    product = StaffLinkColumn(view='asuzr.views.production_table',
                              verbose_name='Наименование')
    delivery = EditableColumn('delivery', verbose_name='Доставка')
    lifting = EditableColumn('lifting', verbose_name='Подъем')
    address = tables.Column(verbose_name='Адрес')
    price = tables.Column(verbose_name='Стоимость')
    paid = EditableColumn('paid', verbose_name='Оплачено')
    ostatok = tables.Column(verbose_name='Остаток')
    approved = EditableColumn('approved', verbose_name='Согласовано')
    sketch = tables.LinkColumn('asuzr.views.sketches',
                               verbose_name='Эскизы',
                               args=[tables.utils.A('pk')])
    executor = EditableColumn('executor', verbose_name='Исполнитель')
    is_done = EditableColumn('is_done', verbose_name='Сдан')

    def render_price(self, value):
        return '%0.2f' % value

    def render_ostatok(self, value):
        return '%0.2f' % value

    class Meta:
        model = Order
        empty_text = 'Незавершенных заказов нет'
        attrs = {'class': 'paleblue'}
        sequence = (
            'date',
            'deadline',
            'product',
            'delivery',
            'lifting',
            'address',
            'price',
            'paid',
            'ostatok',
            'approved',
            'sketch',
            'executor',
            'is_done',
        )
        exclude = (
            'id',
            'calls',
            'contact',
            'phone_num',
            'cancelled',
            'designer',
        )
Esempio n. 23
0
class TaskTable(tables.Table):
    id = tables.TemplateColumn(
        '<a href="/trees/task-edit/{{record.id}}/">{{record.id}}</a>')
    date_generated = tables.DateColumn(format='d.m.Y')
    date_completed = tables.DateColumn(format='d.m.Y')

    class Meta:
        model = Task
        template_name = 'django_tables2/bootstrap.html'
        fields = [
            'id', 'task_type', 'status', 'date_generated', 'date_completed',
            'generation', 'description', 'task_force', 'cost', 'all_trees',
            'user'
        ]
Esempio n. 24
0
class DisciplinaryStatusTable(tables.Table):
    user = tables.Column(verbose_name="Name of Accused")
    status = tables.Column()
    approved = tables.Column()
    created = tables.DateColumn()
    trial_date = tables.DateColumn()
    link = tables.TemplateColumn(
        '{% if record.link %}<a href="{{ record.link }}">Form 2 Link</a>{% endif %}'
    )

    class Meta:
        attrs = {
            "class": "table table-striped table-bordered",
        }
Esempio n. 25
0
class TreeTable(tables.Table):
    #edit = tables.LinkColumn('tree-update', text='Edit', args=[A('pk')], orderable=False, empty_values=())

    #def render_edit(self):
    #return 'Edit'
    #latin_name = tables.LinkColumn("tree-edit", args=[A("pk")], empty_values=()) #- Why this line of code does not work/tree-edit cannot be found???
    id = tables.TemplateColumn(
        '<a href="/trees/tree-edit/{{record.id}}/">{{record.id}}</a>')
    origin_date = tables.DateColumn(format='d.m.Y')
    end_date = tables.DateColumn(format='d.m.Y')

    class Meta:
        model = Tree
        template_name = 'django_tables2/bootstrap.html'
Esempio n. 26
0
class ResearchEventTable(tables.Table):
    id = tables.LinkColumn('archiv:researchevent_detail',
                           args=[A('pk')],
                           verbose_name='ID')
    start_date = tables.DateColumn(format='Y-m-d')
    end_date = tables.DateColumn(format='Y-m-d')
    site_id = tables.ManyToManyColumn()
    responsible_researcher = tables.ManyToManyColumn()
    responsible_institution = tables.ManyToManyColumn()
    research_method = tables.ManyToManyColumn()

    class Meta:
        model = ResearchEvent
        sequence = ('id', 'start_date', 'end_date')
        attrs = {"class": "table table-responsive table-hover"}
Esempio n. 27
0
class ProjectTable(tables.Table):
    id = tables.Column()
    title = tables.LinkColumn('project:detail', kwargs={"project_id": A('id')},
                              attrs={'td': {'width': '30%'}})
    start_date = tables.DateColumn(attrs={'td': {'align': 'center',
                                                 'width': '2%'}})
    end_date = tables.DateColumn(attrs={'td': {'align': 'center',
                                               'width': '2%'}})
    is_active = tables.BooleanColumn(attrs={'td': {'align': 'center',
                                                   'width': '10%'}})

    class Meta:
        model = Project
        attrs = {'class': 'table table-bordered table-striped table-hover'}
        exclude = ('id', 'is_active', 'description')
Esempio n. 28
0
class PledgeProgramTable(tables.Table):
    date_complete = tables.DateColumn(verbose_name="Complete Date")
    date_initiation = tables.DateColumn(verbose_name="Initiation Date")
    remote = tables.BooleanColumn(verbose_name="Remote")
    weeks = tables.Column(verbose_name="Weeks in Program")
    weeks_left = tables.Column(verbose_name="Weeks LEFT in Program")
    status = tables.Column(verbose_name="Program Status")
    approval = tables.Column()
    chapter_name = tables.Column(verbose_name="Chapter")
    pk = tables.LinkColumn(
        "forms:pledge_program_detail", verbose_name="Link", args=[A("pk")]
    )

    class Meta:
        model = PledgeProgram
        order_by = "chapter"
        attrs = {"class": "table table-striped table-bordered"}
        fields = [
            "chapter_name",
            "region",
            "school",
            "year",
            "term",
            "pk",
            "manual",
            "approval",
            "remote",
            "date_complete",
            "date_initiation",
            "weeks",
            "weeks_left",
            "status",
        ]

    def render_status(self, value):
        return PledgeProgram.STATUS.get_value(value)

    def render_term(self, value):
        return PledgeProgram.TERMS.get_value(value)

    def render_manual(self, value):
        return PledgeProgram.MANUALS.get_value(value)

    def render_approval(self, value):
        if value == "not_submitted":
            return "Not Submitted"
        else:
            return PledgeProgramProcess.APPROVAL.get_value(value)
Esempio n. 29
0
class LogEntryTable(tables.Table):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.length = 10

    action_time = tables.DateColumn(format="Nd, g:ia")
    object_id = tables.Column(verbose_name="Name")
    change_message = tables.Column(verbose_name="Reason", empty_values=[None])
    change_message.orderable = False

    def render_change_message(self, record):
        message = record.get_change_message()
        if record.is_change():
            return message
        elif record.is_addition():
            return mark_safe(
                '<span class="glyphicon glyphicon-plus text-success"></span> %s'
                % message)  # nosec - internal data
        else:
            return mark_safe(
                '<span class="glyphicon glyphicon-remove text-danger"></span> %s'
                % message)  # nosec - internal data

    class Meta(LavaTable.Meta):
        model = LogEntry
        fields = ('action_time', 'object_id', 'user', 'change_message')
        sequence = ('action_time', 'object_id', 'user', 'change_message')
Esempio n. 30
0
class PaymentRequestsDashboardTable(BasePaymentRequestsTable):
    date_from = tables.DateColumn(verbose_name='Period Start')
    date_to = tables.DateColumn(verbose_name='Period End')

    class Meta:
        fields = [
            'project',
            'status',
            'requested_at',
            'date_from',
            'date_to',
            'value',
        ]
        model = PaymentRequest
        orderable = False
        order_by = ['-requested_at']