Beispiel #1
0
class SpacesTable(tables.Table):
    selection = tables.CheckBoxColumn(
        accessor="Id",
        attrs={"th__input": {
            "onclick": "toggle(this)"
        }},
        orderable=False,
        empty_values=(),
        footer='Total:')
    Campus = tables.Column(orderable=True)
    Building = tables.Column(orderable=True)
    Floor = tables.Column(orderable=True)
    Id = tables.Column(orderable=True)
    Free_Private = tables.Column(orderable=True,
                                 attrs={'cell': {
                                     'class': 'free_private'
                                 }})
    Free_Shared = tables.Column(orderable=True,
                                attrs={'cell': {
                                    'class': 'free_shared'
                                }})
    Near_Low_Density_Lab = tables.BooleanColumn(
        orderable=True, attrs={'cell': {
            'class': 'low_density'
        }})
    Near_High_Density_Lab = tables.BooleanColumn(
        orderable=True, attrs={'cell': {
            'class': 'high_density'
        }})
    Groups_Nearby = tables.Column(attrs={'cell': {'class': 'business_groups'}})
Beispiel #2
0
class DeviceTypeTable(BaseTable):
    pk = ToggleColumn()
    model = tables.LinkColumn('dcim:devicetype',
                              args=[Accessor('pk')],
                              verbose_name='Device Type')
    is_full_depth = tables.BooleanColumn(verbose_name='Full Depth')
    is_console_server = tables.BooleanColumn(verbose_name='CS')
    is_pdu = tables.BooleanColumn(verbose_name='PDU')
    is_network_device = tables.BooleanColumn(verbose_name='Net')
    subdevice_role = tables.TemplateColumn(SUBDEVICE_ROLE_TEMPLATE,
                                           verbose_name='Subdevice Role')
    instance_count = tables.Column(verbose_name='Instances')

    class Meta(BaseTable.Meta):
        model = DeviceType
        fields = (
            'pk',
            'model',
            'manufacturer',
            'part_number',
            'u_height',
            'is_full_depth',
            'is_console_server',
            'is_pdu',
            'is_network_device',
            'subdevice_role',
            'instance_count',
        )
Beispiel #3
0
class MemberTable(tables.Table):
    name = table.Column()
    first_name = table.Column()
    birth_date = table.DateColumn(format='d.m.Y')
    gender = table.Column()
    grade = table.Column()
    email = table.EmailColumn()
    zekken = table.BooleanColumn()
    jacket = table.BooleanColumn()
    active = table.BooleanColumn()
    id = table.TemplateColumn(link_template, verbose_name='', attrs={'th':{'class':'test'}})

    class Meta:
        model = Member
        template_name = 'django_tables2/bootstrap-responsive.html'
        sequence = ('first_name', 'name', 'birth_date', 'gender', 'grade', 'email', 'zekken', 'jacket', 'active', '...')
        attrs = {'class': 'table table-striped'}

    def render_zekken(self, value):
        return self.render_boolean(value)

    def render_jacket(self, value):
        return self.render_boolean(value)

    def render_active(self, value):
        return self.render_boolean(value)

    def render_boolean(self, value):
        if value:
            return format_html('<i class="far fa-check-square"></i>')
        else:
            return format_html('<i class="far fa-square"></i>')
Beispiel #4
0
class GlobalConfigModelTable(tables.Table):
    hostname = tables.Column(tables.A('Hostname'), linkify=True)
    gui_certificates = tables.BooleanColumn(tables.A('Show GUI Certificates'),
                                            yesno='enabled,disabled')
    gui_display_hostname = tables.BooleanColumn(tables.A('Show Hostname'),
                                                yesno='enabled,disabled')
    global_config_id = tables.LinkColumn('global-delete',
                                         text='Delete',
                                         args=[tables.A('pk')],
                                         verbose_name='Delete')

    class Meta:
        model = GlobalConfigModel
        template_name = 'django_tables2/bootstrap.html'
        exclude = ([
            # ' field_name'
        ])
        sequence = (
            'hostname',
            'admin_port',
            'admin_sport',
            'admin_ssh_port',
            'admintimeout',
            'gui_certificates',
            'gui_display_hostname',
            'timezone',
            'config',
            'global_config_id',
        )
Beispiel #5
0
class ConfigurationTable(PaginateTable):
    """Table used to show the configurations

    Also provides actions to edit and delete"""

    actions = ActionsColumn([
        {'title': '<i class="glyphicon glyphicon-pencil"></i>', 'url': 'projects_configuration_update', 'args': [tables.A('pk')],
         'attrs':{'data-toggle': 'tooltip', 'title': 'Edit Configuration', 'data-delay': '{ "show": 300, "hide": 0 }'}},
        {'title': '<i class="glyphicon glyphicon-trash"></i>', 'url': 'projects_configuration_delete', 'args': [tables.A('pk')],
         'attrs':{'data-toggle': 'tooltip', 'title': 'Delete Configuration', 'data-delay': '{ "show": 300, "hide": 0 }'}},
    ], delimiter='&#160;&#160;&#160;')

    key = tables.LinkColumn('projects_configuration_update', kwargs={'pk': tables.A('pk')})
    value = tables.Column(accessor='get_display_value', orderable=False)

    # Clean up the labels a little
    prompt_me_for_input = tables.BooleanColumn(verbose_name="Prompt?",)
    sensitive_value = tables.BooleanColumn(verbose_name="Sensitive?",)

    class Meta:
        model = models.Configuration
        attrs = {"class": "table table-striped"}
        sequence = fields = (
            'key',
            'value',
            'prompt_me_for_input',
            'sensitive_value',
        )
 class Table(tables.Table):
     col = tables.BooleanColumn(attrs={"span": {"key": "value"}})
     col_linkify = tables.BooleanColumn(
         accessor="col",
         attrs={"span": {
             "key": "value"
         }},
         linkify=lambda value: "/bool/{}".format(value),
     )
Beispiel #7
0
class FahrplanZugTable(tables.Table):
    name = tables.LinkColumn()
    nummer = ArrayListColumn(seperator=' ')
    deko_zug = tables.BooleanColumn(verbose_name='Deko')
    fz_max_speed = SpeedColumn(verbose_name='Speed Max*')
    anfang_zeit = tables.DateTimeColumn(short=True)
    gesamt_zeit = tables.Column(verbose_name='Gesamt Fahrzeit')
    masse = tables.Column(verbose_name='Masse*')
    laenge = tables.Column(verbose_name='Laenge*')
    bremse_percentage = tables.Column(verbose_name='Brems%*')
    steuerfahrzeug = tables.Column(verbose_name='Fahrzeug')
    zeit_bewegung = tables.Column(verbose_name='Zeit in Bewegung')
    fis_ansagen = tables.BooleanColumn(verbose_name='FIS')

    def render_gesamt_zeit(self, value):
        return "{0:02}:{1:02}".format(value.seconds // 3600,
                                      (value.seconds // 60) % 60)

    def render_zeit_bewegung(self, value):
        return "{0:02}:{1:02}".format(value.seconds // 3600,
                                      (value.seconds // 60) % 60)

    def render_is_reisezug(self, value):
        return 'Reisezug' if value else 'Güterzug'

    def render_masse(self, value):
        return "{0} t".format(int(value / 1000))

    def render_laenge(self, value):
        return "{0} m".format(int(value))

    def render_bremse_percentage(self, value):
        return "{0} %".format(int(value * 100))

    def render_steuerfahrzeug(self, value, record):
        if record.triebfahrzeug and record.triebfahrzeug != value:
            return "{0}/{1}".format(value, record.triebfahrzeug)
        else:
            return value

    class Meta:
        model = FahrplanZug
        sequence = ('name', 'gattung', 'nummer', 'zug_lauf', 'is_reisezug',
                    'fz_max_speed', 'deko_zug', 'masse', 'laenge',
                    'bremse_percentage', 'steuerfahrzeug', 'anfang_zeit',
                    'gesamt_zeit', 'zeit_bewegung')
        exclude = ('fahrzeug_tree', 'path', 'fahrplan_gruppe', 'speed_zug',
                   'speed_anfang', 'bild', 'deko', 'bremsstellung',
                   'triebfahrzeug', 'is_reisezug')
        order_by = ('name', )
        attrs = {'class': 'table table-striped table-hover'}
        row_attrs = {
            'class': lambda record: 'danger' if record.deko_zug else None
        }
Beispiel #8
0
class TransactionTable(tables.Table):
    idtransaction = tables.Column(verbose_name="id")
    cal_due_date = tables.DateColumn(verbose_name="Due Date", orderable=False)
    is_returned = tables.BooleanColumn(verbose_name="Is it returned?",
                                       orderable=False)
    is_overdue = tables.BooleanColumn(verbose_name="Is it overdue?",
                                      orderable=False)

    class Meta:
        model = Transaction
        attrs = {"class": "paleblue"}
class Produser(tables.Table):
    id = tables.Column()
    name = tables.Column()
    rating = tables.Column()
    guitar = tables.BooleanColumn()
    bridge = tables.BooleanColumn()
    pickups = tables.BooleanColumn()
    info = tables.Column()

    class Meta:
        attrs = {"class": "paleblue"}
Beispiel #10
0
class UsersTable(tables.Table):
    class Meta:
        attrs = {'class': 'pltest'}
    id = tables.Column()
    username = tables.Column()
    email = tables.Column()
    last_name = tables.Column()
    first_name = tables.Column()
    last_login = tables.Column()
    is_superuser = tables.BooleanColumn()
    is_active = tables.BooleanColumn()
    date_joined = tables.Column()
Beispiel #11
0
class CertificatesTable(tables.Table):
    cert_type = tables.Column(verbose_name='ΤΥΠΟΣ',orderable=False)
    copies = tables.Column(verbose_name='ΑΝΤΙΤΥΠΑ',orderable=False)
    date_requested = tables.DateColumn(verbose_name='ΗΜΕΡΟΜΗΝΙΑ',orderable=False)
    available= tables.BooleanColumn(verbose_name='ΔΙΑΘΕΣΙΜΟ',orderable=False)
    received = tables.BooleanColumn(verbose_name='ΠΑΡΑΔΟΘΗΚΕ',orderable=False)
    class Meta:
        model = Certificate
        fields = {'cert_type','copies','date_requested','available','received'}
        sequence = ('cert_type','copies','date_requested','available','received')
        attrs = {'class': 'table table-striped table-certs'}
        template_name = 'django_tables2/bootstrap-responsive.html'     
Beispiel #12
0
class VirtualDeliveryTable(SelMixin, tables.Table):
    id = tables.LinkColumn(viewname='aliases-update', args=[A('pk')])
    alias = tables.Column(verbose_name=_("Alias"))
    alias_domain = tables.Column(verbose_name=_("Alias domain"))
    dest = tables.Column(verbose_name=_("Destination"), accessor='full_dest')
    is_external_alias = tables.BooleanColumn(
        verbose_name=_("Is external alias"))
    is_forwarder = tables.BooleanColumn(verbose_name=_("Is mail forward"))
    is_active = tables.BooleanColumn(verbose_name=_("Is active"))

    class Meta:
        model = VirtualDelivery
        exclude = ['full_dest']
        fields = ['selection', 'id', 'alias', 'alias_domain', 'dest']
        attrs = {'class': 'table'}
Beispiel #13
0
class PagosTable(tables.Table):
    fecha = tables.DateColumn(
        short=False,
        verbose_name="Fecha de Pago",
        attrs={"td": {
            "id": lambda record: "fecha-" + str(record.id)
        }})
    monto = tables.Column(
        verbose_name="Monto ($)",
        attrs={"td": {
            "id": lambda record: "monto-" + str(record.id)
        }})
    es_por_canon = tables.BooleanColumn(
        verbose_name="Tipo",
        yesno="Canon,Infraccion",
        attrs={"td": {
            "id": lambda record: "tipo-" + str(record.id)
        }})
    documento = DocumentColumn("Pago")
    acciones = tables.TemplateColumn(verbose_name="Acciones",
                                     template_name="formButtons.html",
                                     orderable=False)

    class Meta:
        template_name = "django_tables2/semantic.html"
        model = Pago
        fields = ()
        row_attrs = {"id": lambda record: "pago-" + str(record.id)}
Beispiel #14
0
class KPITable(tables.Table):
    action = tables.Column(verbose_name="", accessor='pk', orderable=False)
    active = tables.BooleanColumn(
        attrs={
            'td': {'class': "not-active"},
            'th': {'class': "not-active"}
        }
    )

    class Meta:
        model = KPI
        exclude = ['created', 'modified', 'description', 'id', 'baseline',
                   'customer', 'reporting_method', 'objective', 'calculation']
        sequence = ('name', 'perspective', 'measure', 'target', 'unit',
                    'direction', 'weight', 'reporting_period', 'active', '...')
        empty_text = _("Nothing to show")
        template = "django_tables2/bootstrap.html"
        # per_page = 1
        # attrs = {'class': 'paleblue'}  # add class="paleblue" to <table> tag

    def render_action(self, record):
        return format_html(
            '<a href="{}">Edit</a> | <a href="{}">Delete</a>',
            record.get_edit_url(),
            record.get_delete_url()
        )
Beispiel #15
0
class EntryTable(tables.Table):
    created_on = tables.DateColumn(format="d.m.Y")
    author = tables.Column(verbose_name="Автор",
                           linkify=True,
                           accessor="author")
    status = tables.BooleanColumn(yesno=",".join([
        str(PostStatusChoices.labels.published),
        str(PostStatusChoices.labels.draft)
    ]))
    actions = tables.TemplateColumn(verbose_name="Действия",
                                    template_name="misc/linkbuttons.html",
                                    extra_context={
                                        'view_link': 'news:view',
                                        'edit_link': 'news:edit',
                                        'remove_link': 'news:remove'
                                    },
                                    orderable=False,
                                    exclude_from_export=True)

    class Meta:
        model = Entry
        fields = ['created_on', 'author', 'title', 'status']
        template_name = 'django_tables2/bootstrap4.html'
        attrs = {'class': 'table table-striped table-bordered text-center'}
        empty_text = "Ничего не найдено"
Beispiel #16
0
class FuehrerstandTable(tables.Table):
    name = tables.LinkColumn()
    mit_afb = tables.BooleanColumn(verbose_name='AFB')
    zugsicherung = ArrayListColumn(choices=Fuehrerstand.ZUGSICHERUNG_CHOICES)
    sifa = ArrayListColumn(choices=Fuehrerstand.SIFA_CHOICES)
    tuer_system = ArrayListColumn(verbose_name='Türsteuerung',
                                  orderable=False,
                                  choices=Fuehrerstand.TUER_CHOICES)
    schleuderschutz = ArrayBooleanColumn()
    #notbremse_system = ArrayBooleanColumn(verbose_name='Notbremse')
    fahrzeug_count = tables.Column(verbose_name='Fahrzeugnutzen',
                                   order_by=('fahrzeug_count', 'name'))
    zug_count = tables.Column(verbose_name='Fahrplanzüge',
                              order_by=('zug_count', 'name'))

    class Meta:
        model = Fuehrerstand
        exclude = ('path', 'notbremse_system')
        order_by = ('name', )
        attrs = {'class': 'table table-striped table-hover'}
        row_attrs = {
            'class':
            lambda record: 'danger' if not record.fahrzeug_count else 'warning'
            if not record.zug_count else None
        }
Beispiel #17
0
class ObjectiveTable(tables.Table):
    action = tables.Column(verbose_name="", accessor='pk', orderable=False)
    active = tables.BooleanColumn(attrs={
        'td': {
            'class': "not-active"
        },
        'th': {
            'class': "not-active"
        }
    })

    class Meta:
        model = Objective
        exclude = [
            'created', 'modified', 'description', 'id', 'customer', 'lft',
            'rght', 'tree_id', 'level'
        ]
        sequence = ('name', 'strategic_theme', 'parent', 'active', '...')
        empty_text = _("Nothing to show")
        template = "django_tables2/bootstrap.html"
        # per_page = 1
        # attrs = {'class': 'paleblue'}  # add class="paleblue" to <table> tag

    def render_action(self, record):
        return format_html('<a href="{}">Edit</a> | <a href="{}">Delete</a>',
                           record.get_edit_url(), record.get_delete_url())
Beispiel #18
0
class UnfullFilledOptionTable(tables.Table):
    put = tables.BooleanColumn(accessor=tables.utils.A("calculate_null"),
                               orderable=False)

    class Meta:
        model = Option
        fields = ("lot", "start_time", "end_time", "price", "put")
Beispiel #19
0
class UserProfileTable(tables.Table):
    action = tables.Column(verbose_name="", accessor='pk', orderable=False)
    email = tables.EmailColumn(verbose_name=_("Email"),
                               accessor='user.email',
                               orderable=True)
    active = tables.BooleanColumn(
        attrs={
            'td': {'class': "not-active"},
            'th': {'class': "not-active"}
        }
    )

    class Meta:
        model = UserProfile
        exclude = ['customer', 'created_on', 'updated_on', 'id']
        sequence = ('user', 'email', 'position', 'role', 'active', '...')
        empty_text = _("Nothing to show")
        template = "django_tables2/bootstrap.html"
        # per_page = 1
        # attrs = {'class': 'paleblue'}  # add class="paleblue" to <table> tag

    def render_action(self, record):
        return format_html(
            '<a href="{}">Edit</a>', record.get_edit_url()
        )

    def render_user(self, record):
        return record.get_name()

    def render_email(self, record):
        return record.user.email
Beispiel #20
0
class SourceLexiconTable(DataTable):
    """Lexicon table for Source pages"""
    id = tables.Column()
    language = tables.LinkColumn('language-detail', args=[A('language.slug')])
    word = tables.LinkColumn('word-detail', args=[A('word.slug')])
    entry = tables.Column()
    source_gloss = tables.Column()
    annotation = tables.Column()
    loan = tables.BooleanColumn(null=False, yesno=('x', ''))

    def render_language(self, record):
        col = tables.LinkColumn('language-detail', args=[record.language.slug])
        return col.render(value=record.language,
                          record=record.language,
                          bound_column=None)

    class Meta(DataTable.Meta):
        model = Lexicon
        order_by = 'id'  # default sorting
        sequence = ('id', 'language', 'word', 'entry', 'source_gloss',
                    'annotation', 'loan')
        exclude = (
            'editor',
            'added',
            'slug',
            'phon_entry',
            'loan_source',
            'source',
        )

    Meta.attrs['summary'] = 'Table of Lexicon'
Beispiel #21
0
class TaskLexiconTable(DataTable):
    id = tables.LinkColumn('lexicon-edit', args=[A('id')])
    language = tables.LinkColumn('language-detail', args=[A('language.slug')])
    source = tables.LinkColumn('source-detail', args=[A('source.slug')])
    word = tables.LinkColumn('word-detail', args=[A('word.slug')])
    entry = tables.Column()
    annotation = tables.Column()
    loan = tables.BooleanColumn(null=False, yesno=('x', ''))

    # def render_language(self, record):
    #     col = tables.LinkColumn('language-detail', args=[record.language.slug])
    #     return col.render(value=unicode(record.language), record=unicode(record.language), bound_column=None)

    class Meta(DataTable.Meta):
        model = Lexicon
        order_by = 'word'  # default sorting
        sequence = ('id', 'language', 'word', 'source', 'entry', 'annotation',
                    'loan')
        exclude = (
            'editor',
            'added',
            'slug',
            'phon_entry',
            'loan_source',
        )

    Meta.attrs['summary'] = 'Table of Lexicon'
Beispiel #22
0
class CobrosTable(tables.Table):
    periodo = tables.Column(empty_values=(),
                            order_by=("fecha_desde", "fecha_hasta"))
    fecha_hasta = tables.DateColumn(
        short=False,
        verbose_name="Fecha de Cobro",
        attrs={"td": {
            "id": lambda record: "fecha-" + str(record.id)
        }})
    monto = tables.Column(
        verbose_name="Monto ($)",
        attrs={"td": {
            "id": lambda record: "monto-" + str(record.id)
        }})
    es_por_canon = tables.BooleanColumn(
        verbose_name="Tipo",
        yesno="Canon,Infraccion",
        attrs={"td": {
            "id": lambda record: "tipo-" + str(record.id)
        }})
    documentocob = DocumentColumn("Cobro")
    acciones = tables.TemplateColumn(verbose_name="Acciones",
                                     template_name="formButtons.html",
                                     orderable=False)

    class Meta:
        template_name = "django_tables2/semantic.html"
        model = Cobro
        fields = ()
        row_attrs = {"id": lambda record: "cobro-" + str(record.id)}

    def render_periodo(self, record):
        return "{} al {}".format(record.fecha_desde.strftime('%d/%m/%Y'),
                                 record.fecha_hasta.strftime('%d/%m/%Y'))
Beispiel #23
0
class WorkshopTable(tables.Table):
    class Meta:
        model = Workshop
        fields = ['title', 'active']

    active = tables.BooleanColumn()
    title = tables.LinkColumn()
Beispiel #24
0
class IPAddressTable(BaseTable):
    pk = ToggleColumn()
    address = tables.TemplateColumn(template_code=IPADDRESS_LINK,
                                    verbose_name='IP Address')
    vrf = tables.TemplateColumn(template_code=VRF_LINK, verbose_name='VRF')
    status = tables.TemplateColumn(template_code=STATUS_LABEL)
    tenant = tables.TemplateColumn(template_code=TENANT_LINK)
    assigned = tables.BooleanColumn(accessor='assigned_object_id',
                                    verbose_name='Assigned')

    class Meta(BaseTable.Meta):
        model = IPAddress
        fields = (
            'pk',
            'address',
            'vrf',
            'status',
            'role',
            'tenant',
            'assigned',
            'dns_name',
            'description',
        )
        row_attrs = {
            'class':
            lambda record: 'success'
            if not isinstance(record, IPAddress) else '',
        }
Beispiel #25
0
class JobListingTable(tables.Table):
    name = tables.LinkColumn("core:job_detail",
                             kwargs={"id":A('id')},
                             text=lambda record: record.name,
                             verbose_name="Listing",
                             )
    company = tables.Column(verbose_name="Company")
    status = tables.Column(verbose_name="Status")
    date_posted = tables.DateTimeColumn(
        format="D, j N",
        verbose_name="Posted"
    )
    get_last_touch = tables.DateTimeColumn(
        format="D, j N",
        verbose_name="Updated"
    )
    can_be_remote = tables.BooleanColumn(
        verbose_name="Remote?"
    )
    class Meta:
        model = JobListing
        attrs = {"class":"table"}
        sequence = (
            "name",
            "company",
            "status",
            "sourceSite",
            "can_be_remote",
            "date_posted",
            "get_last_touch",
        )
        fields = {
            "name", "company", "status", "sourceSite", "can_be_remote", "date_posted", "get_last_touch",
        }
Beispiel #26
0
class IPAddressDetailTable(IPAddressTable):
    nat_inside = tables.Column(
        linkify=True,
        orderable=False,
        verbose_name='NAT (Inside)'
    )
    tenant = tables.TemplateColumn(
        template_code=COL_TENANT
    )
    assigned = tables.BooleanColumn(
        accessor='assigned_object_id',
        verbose_name='Assigned'
    )
    tags = TagColumn(
        url_name='ipam:ipaddress_list'
    )

    class Meta(IPAddressTable.Meta):
        fields = (
            'pk', 'address', 'vrf', 'status', 'role', 'tenant', 'nat_inside', 'assigned', 'dns_name',
            'description', 'tags',
        )
        default_columns = (
            'pk', 'address', 'vrf', 'status', 'role', 'tenant', 'assigned', 'dns_name', 'description',
        )
Beispiel #27
0
class RiskFormTable(tables.Table):
    chapter = tables.Column(
        attrs={"td": {"align": "left", "style": "font-weight:bold"}}
    )
    all_complete = tables.BooleanColumn()
    region = tables.Column()
    corresponding_secretary = tables.LinkColumn(
        "forms:rmp_complete", kwargs={"pk": A("corresponding_secretary_pk")}
    )
    treasurer = tables.LinkColumn(
        "forms:rmp_complete", kwargs={"pk": A("treasurer_pk")}
    )
    scribe = tables.LinkColumn("forms:rmp_complete", kwargs={"pk": A("scribe_pk")})
    vice_regent = tables.LinkColumn(
        "forms:rmp_complete", kwargs={"pk": A("vice_regent_pk")}
    )
    regent = tables.LinkColumn("forms:rmp_complete", kwargs={"pk": A("regent_pk")})

    class Meta:
        attrs = {
            "class": "table table-striped table-bordered",
            "td": {
                "align": "center",
                "complete": lambda value: get_value_from_a(value),
            },
            "th": {"class": "text-center"},
        }
Beispiel #28
0
class ContactTable(tables.Table):

    select = tables.CheckBoxColumn(accessor='pk')
    phone = tables.Column(verbose_name='Number')
    first_name = tables.LinkColumn(verbose_name="First Name",
                                   text=lambda t: t.first_name,
                                   args=[A('pk')])
    last_name = tables.Column(verbose_name="Last Name")
    active = tables.BooleanColumn(verbose_name="Active?")
    email = tables.EmailColumn(verbose_name="Email",
                               text=lambda row: "%s..." % row.email[:10]
                               if len(row.email) > 10 else row.email)
    nickname = tables.Column(verbose_name="Nickname")
    action = tables.Column(verbose_name="", accessor='pk', orderable=False)

    def render_phone(self, record):
        return mark_safe("<span>{}</span>".format(record.phone))

    def render_action(self, record):
        return mark_safe('<div style="width:6rem;"><a class="call-btn" href="#"><i style="font-size: 16pt;" class="fi-telephone"></i></a>'+\
                         '<a class="sms-btn" href="#"><i style="font-size: 16pt;" class="fi-mail"></i></a></div>'
                         )

    class Meta:
        model = Contact
        fields = ('select', 'first_name', 'last_name', 'nickname', 'email',
                  'phone', 'active', 'action')
        empty_text = "Sorry, No Contact Found"
        attrs = {'style': 'width: 100%'}
Beispiel #29
0
class AlignmentTable(WordLexiconTable):
    id = tables.LinkColumn('lexicon-edit', args=[A('id')])
    language = tables.LinkColumn('language-detail', args=[A('language.slug')])
    source = tables.LinkColumn('source-detail', args=[A('source.slug')])
    entry = tables.Column()
    alignment = tables.Column(
        attrs={"td": {
            "style": "font-family: monospace;"
        }})
    annotation = tables.Column()
    loan = tables.BooleanColumn(null=False, yesno=('x', ''))

    def render_language(self, record):
        col = tables.LinkColumn('language-detail', args=[record.language.slug])
        return col.render(value=record.language,
                          record=record.language,
                          bound_column=None)

    class Meta(WordLexiconTable.Meta):
        model = Lexicon
        order_by = 'word'  # default sorting
        sequence = ('id', 'language', 'entry', 'alignment', 'annotation',
                    'loan', 'source')
        exclude = ('editor', 'added', 'slug', 'phon_entry', 'loan_source',
                   'word', 'source_gloss')

    Meta.attrs['summary'] = 'Table of Lexicon'
Beispiel #30
0
class OUTable(tables.Table):
    name = tables.Column(verbose_name=_('label'))
    default = tables.BooleanColumn()

    class Meta:
        model = get_ou_model()
        attrs = {'class': 'main', 'id': 'ou-table'}
        fields = ('name', 'default')
        empty_text = _('None')