Beispiel #1
0
class ProgramTable(CountedMixin, Table):
    name = LinkColumn("program-detail", args=[A("pk")])
    university = LinkColumn("university-detail", args=[A("pk")])

    class Meta:
        model = Program
        fields = ["row_number", "name", "university"]
Beispiel #2
0
class ManageNumberTable(tables.Table):
    request = None
    number = LinkColumn('manager:number', args=[A('competition_id'), A('pk')])

    def render_number(self, record, **kwargs):
        url = reverse('manager:number', kwargs={'pk': self.request_kwargs.get('pk'), 'pk_number': record.id})
        return mark_safe('<a href="%s">%s</a>' % (url, record.number))

    def render_participant_slug(self, record, **kwargs):
        if record.participant_id:
            url = reverse('manager:participant',
                          kwargs={'pk': self.request_kwargs.get('pk'), 'pk_participant': record.participant_id})
            return mark_safe('<a href="%s">%s</a>' % (url, record.participant_slug))
        elif record.participant_slug:
            return record.participant_slug
        else:
            return '-'

    def __init__(self, *args, **kwargs):
        self.request = kwargs.pop('request')
        self.request_kwargs = kwargs.pop('request_kwargs')
        super(ManageNumberTable, self).__init__(*args, **kwargs)

    class Meta:
        model = Number
        attrs = {"class": "table table-striped table-hover"}
        fields = ("distance", "status", 'number', 'number_text', 'participant_slug', 'group')
        empty_text = _("You haven't added any number")
        per_page = 100
        template = "bootstrap/table.html"
Beispiel #3
0
class ServiceTable(tables.Table):
    name = LinkColumn('Service', args=[A('pk')])
    country_of_origin = Column()

    class Meta:
        model = Service
        fields = ('name', 'country_of_origin', 'sector')
Beispiel #4
0
class DeploymentTable(PaginateTable):
    """Table used to show the deployments

    Also provides actions to view individual deployment"""

    date_created = tables.Column(verbose_name='Created')

    user = LinkColumn('accounts_user_view',
                      accessor='user.email',
                      args=[tables.A('user.pk')],
                      attrs={
                          'data-toggle': 'tooltip',
                          'title': 'View user details',
                          'data-delay': '{ "show": 300, "hide": 0 }'
                      },
                      verbose_name='Deployer')

    stage = tables.Column(verbose_name='Stage')

    task_name = tables.Column(accessor='task.name', verbose_name='Task')

    status = tables.TemplateColumn(
        template_name='projects/pieces/deployment_status_column.html',
        verbose_name='Status')

    actions = ActionsColumn([
        {
            'title':
            '<i class="glyphicon glyphicon-file"></i>',
            'url':
            'projects_deployment_detail',
            'args': [
                tables.A('stage.project_id'),
                tables.A('stage_id'),
                tables.A('pk')
            ],
            'attrs': {
                'data-toggle': 'tooltip',
                'title': 'View Deployment Details',
                'data-delay': '{ "show": 300, "hide": 0 }'
            }
        },
    ],
                            delimiter='&#160;&#160;&#160;')

    class Meta:
        model = models.Deployment
        attrs = {"class": "table table-striped"}
        sequence = fields = (
            'date_created',
            'user',
            'stage',
            'task_name',
            'status',
            'actions',
        )
Beispiel #5
0
class ChangedNameTable(GetRequestTableKwargs, tables.Table):
    id = LinkColumn('manager:changedname', args=[A('id')], accessor="id", verbose_name=_('ID'), )

    class Meta:
        model = ChangedName
        attrs = {"class": "table table-striped table-hover"}
        fields = ("id", "slug", "new_slug",)
        empty_text = _("There are no records.")
        per_page = 100
        template = "bootstrap/table.html"
Beispiel #6
0
class PreNumberAssignTable(GetRequestTableKwargs, tables.Table):
    id = LinkColumn('manager:prenumber', args=[A('competition_id'), A('id')], accessor="id", verbose_name=_('ID'), )

    class Meta:
        model = PreNumberAssign
        attrs = {"class": "table table-striped table-hover"}
        fields = ("id", "distance", "number", "segment", "participant_slug", "group_together")
        empty_text = _("There are no records.")
        per_page = 100
        template = "bootstrap/table.html"
Beispiel #7
0
class ManagePriceTable(GetRequestTableKwargs, tables.Table):
    id = LinkColumn('manager:price', args=[A('competition_id'), A('id')], accessor="id", verbose_name=_('ID'), )

    class Meta:
        model = Price
        attrs = {"class": "table table-striped table-hover"}
        fields = ("id", "distance", "from_year", "till_year", "price", "start_registering", "end_registering")
        empty_text = _("There are no pricing records.")
        per_page = 100
        template = "bootstrap/table.html"
Beispiel #8
0
class UrlSyncTable(GetRequestTableKwargs, tables.Table):
    id = LinkColumn('manager:urlsync', args=[A('competition_id'), A('id')], accessor="id", verbose_name=_('ID'), )

    class Meta:
        model = UrlSync
        attrs = {"class": "table table-striped table-hover"}
        fields = ("id", "competition", "url", "kind", "index", "current_line", "enabled", "expires", "total_run_count")
        empty_text = _("There are no Sync tasks")
        per_page = 100
        template = "bootstrap/table.html"
Beispiel #9
0
class ManageInvoiceTable(GetRequestTableKwargs, tables.Table):

    status = LinkColumn('manager:invoice', args=[A('competition_id'), A('id')], accessor="payment.status", verbose_name=_('Invoice status'), )

    class Meta:
        model = Invoice
        attrs = {"class": "table table-striped table-hover"}
        fields = ("id", "status", "file", "series", "number")
        empty_text = _("There are no invoice records.")
        per_page = 100
        template = "bootstrap/table.html"
Beispiel #10
0
class ChipDesignTable(Table):
    id = Column(orderable=False, verbose_name='')
    name = LinkColumn('work_bench_open', args=[A('id')])
    edit_link = EditLinkIcon(url='modify_design', args=[A('id')])
    delete_link = DeleteLinkIcon(url='delete_design', args=[A('id')])

    class Meta:
        model = ChipDesign
        fields = ('name', 'technology', 'description', 'edit_link',
                  'delete_link', 'id')  # fields to display
        attrs = {'class': 'table table-striped'}
Beispiel #11
0
class CommitTableWithAuthor(CommitTable):
    author = LinkColumn(
        "contributor_commits",
        text=lambda record: record.author.username,
        args=[A("author.id")],
    )

    class Meta:
        model = Commit

        fields = ["sha", "author", "creation_date", "message"]
        attrs = {"class": "responsive-table striped"}
Beispiel #12
0
class ManageDistanceAdminTable(GetRequestTableKwargs, tables.Table):
    distance = LinkColumn('manager:distance_admin', args=[A('competition_id'), A('pk')])

    def render_zero(self, record):
        return record.zero

    class Meta:
        model = DistanceAdmin
        attrs = {"class": "table table-striped table-hover"}
        fields = ("distance", 'zero', 'distance_actual',)
        empty_text = _("You haven't added any distance")
        order_by = ("distance")
        per_page = 100
        template = "bootstrap/table.html"
Beispiel #13
0
class ManageMemberApplicationTable(GetRequestTableKwargs, tables.Table):
    title = Column(verbose_name='Team Title', accessor='member.team')
    participant = LinkColumn('manager:participant', args=[A('competition_id'), A('participant.id')],
                             accessor="participant.full_name", verbose_name='Participant')
    unpaid_participant = LinkColumn('manager:participant', args=[A('competition_id'), A('participant_unpaid.id')],
                                    accessor="participant_unpaid.full_name", verbose_name='Unpaid Participant')
    potential_participant = LinkColumn('manager:participant', args=[A('competition_id'), A('participant_potential.id')],
                                       accessor="participant_potential.full_name",
                                       verbose_name=' Potential Participant')

    def render_title(self, record, **kwargs):
        url = reverse('manager:edit_team', kwargs={'pk': self.request_kwargs.get('pk'), 'pk2': record.member.team_id})
        return mark_safe('<a href="%s">%s</a>' % (url, record.member.team))

    class Meta:
        model = MemberApplication
        attrs = {"class": "table table-striped table-hover"}
        fields = ("member", "kind",)
        sequence = ('title', 'member', 'kind', 'participant', 'unpaid_participant', 'potential_participant')
        empty_text = _("You haven't added any applied member")
        order_by = ("title", "kind")
        per_page = 100
        template = "bootstrap/table.html"
class BassAddressTable(tables.Table):
    map_link = LinkColumn(text='', orderable=False)

    def safe_get_value(self, record, attr):
        return (getattr(record, attr) if hasattr(record, attr) else record.get(
            attr, ''))

    def render_map_link(self, record):
        extra_classes = 'btn-info disabled'
        address = self.safe_get_value(record, 'address')
        latitude = self.safe_get_value(record, 'latitude')
        longitude = self.safe_get_value(record, 'longitude')
        if address and latitude and longitude:
            extra_classes = 'btn-success'
        query_ = ('&query={address}&query={latitude},'
                  '{longitude}&zoom=7'.format(latitude=latitude,
                                              longitude=longitude,
                                              address=address))
        url = settings.VIEW_GOOGLE_MAP_LINK + query_
        return (mark_safe('<a href="{url}" target="__blank" '
                          'class="btn {extra_classes}">'
                          'Open Map</a>'.format(url=url,
                                                extra_classes=extra_classes)))
Beispiel #15
0
class UserTable(CountedMixin, Table):
    username = LinkColumn("user-detail", args=[A("pk")])

    class Meta:
        model = get_user_model()
        fields = ["row_number", "username", "first_name", "last_name"]
Beispiel #16
0
class UniversityTable(CountedMixin, Table):
    name = LinkColumn("university-detail", args=[A("pk")])

    class Meta:
        model = University
        fields = ["row_number", "name"]