Пример #1
0
    def test_render(self):
        # Bouton tout pourri qui affiche "Accueil -> [ Jardins, Variétés ]"
        column = DropDownLinkColumn(links=[
            Link(text=u'Main button',
                 viewname='s5appadherant:accueil'),
            Link(text=u'Jardins',
                 viewname='s5appadherant:jardin_all',
                 args=()),
            Link(text=u'Variété',
                 viewname='s5appadherant:variete_list')
        ])

        output = column.render(G(Adherant))
        html = lxml.html.fromstring(output)

        elements = html.cssselect(".btn-group > a")
        self.assertEqual(1, len(elements))
        self.assertEqual(u'Main button', elements[0].text)
        self.assertEqual(reverse('s5appadherant:accueil'), elements[0].attrib['href'])

        elements = html.cssselect("button.dropdown-toggle")
        self.assertEqual(1, len(elements))
        self.assertEqual('dropdown', elements[0].attrib['data-toggle'])

        elements = html.cssselect("ul.dropdown-menu li a")
        self.assertEqual(2, len(elements))
        self.assertEqual(u'Jardins', elements[0].text)
        self.assertEqual(reverse('s5appadherant:jardin_all'), elements[0].attrib['href'])
        self.assertEqual(u'Variété', elements[1].text)
        self.assertEqual(reverse('s5appadherant:variete_list'), elements[1].attrib['href'])
Пример #2
0
class pc_listTable(Table):
    #id = Column(field='id',header='ID')

    name = Column(field='host_name', header='Host Name')
    service_tag = Column(field='service_tag', header='Service_Tag')
    hosttype = Column(field='hosttype.name', header='Type')
    host_model = Column(field='host_model', header='Model')
    receive_date = Column(field='receive_date', header='Receive_date')
    user = Column(field='user_list.full_name', header='User Name')
    bl_list = Column(field='user_list.dept_list.bl_list.bl_name', header='BL')
    site = Column(field='site.sitename', header='Site Code')
    host_status = Column(field='host_status', header='Status')
    seatno = Column(field='seat_no', header='Seat No')
    asset_code = Column(field='asset_code', header='Asset Code')
    OP = LinkColumn(header=u'操作',
                    searchable=False,
                    sortable=False,
                    links=[
                        Link(text=u'编辑', viewname='pcedit', args=(A('id'), )),
                    ])

    class Meta:
        model = pc_list
        ext_button = True
        template_name = 'table/buttons_table.html'
        ajax = True
        ajax_source = reverse_lazy('pc_table_data')
Пример #3
0
class UserGroupLeaderTable(Table):
	name = LinkColumn(field='name',header=u'Group Name', links=[Link(text=A('name'), viewname='leaders-members-list-view', args=(A('id',),))])
	created_date = Column(field='created_date', header=u'Created Date', attrs={'class': 'custom'})
	last_modified = Column(field='last_modified', header=u'Last Modified date', attrs={'class': 'custom'})
	class Meta:
		model = UserGroup
		info_format = u"Total: _TOTAL_  First: _START_  Last: _END_"
class OrgTable(Table):
    view = LinkColumn(
        header='View',
        links=[
            Link(
                text='',
                viewname='org-detail',
                args=(A('id'), ),
                attrs={'class': 'glyphicon glyphicon-eye-open'},
            ),
        ],
        searchable=False,
        sortable=False,
    )

    name = CustomNoneColumn(field='name', header='Name')
    cons = Column(field='num_contacts', header='Contacts')
    notes = BleachTrimColumn(field='notes', header='Notes')

    class Meta:
        model = Organization
        search = True
        ajax = True
        ajax_source = reverse_lazy('data-organization')

        attrs = {'class': 'table-striped table-hover'}
Пример #5
0
class ContactTaskTable_Link(Table):
    """
    Meant to be used from the "perspective" of a single Task.
    Displays the associated contacts, and the role of each.
    """
    view =  LinkColumn(
        header='View', 
        links=[
            Link(
                text='',
                viewname='contact-detail', 
                args=(
                    A('con.id'),
                ),
                attrs={
                    'class':
                        'glyphicon glyphicon-eye-open'
                },
            ),
        ],
        searchable=False,
        sortable=False,
    )

    class Meta:
        model = TaskContactAssoc
        search = True
        ajax = False

        attrs = {'class': 'table-striped table-hover'}
Пример #6
0
class CultureTable(Table):
    photo = ImageColumn(field='variete.photo', header='Photo', sortable=False)
    appelation = Column(field='variete.nom', header='Appelation')
    date_debut = DatetimeColumn(field='date_debut', header='Cultivée depuis', format="%d %B %Y")
    type_conservation = Column(field='type_conservation', header='Type de conservation')
    action = LinkColumn(header='Action',
                        sortable=False,
                        links=[
                            Link(
                                text='Fiche variété',
                                viewname='s5appadherant:variete_detail',
                                args=(A('variete.id'),))
                        ])

    def __init__(self, *args, **kwargs):
        jardin = kwargs.pop('jardin', None)
        if not isinstance(jardin, Jardin):
            raise ValueError("CultureTable: aucun jardin défini")

        super(CultureTable, self).__init__(*args, **kwargs)

        self.opts.ajax_source = reverse_lazy('s5appadherant:culture_data', kwargs={
            'jardin_id': jardin.id
        })
        self.addons.pagination.length = 5

    class Meta:
        search = False
        pagination_next = 'Suivant'
        pagination_prev = 'Précédent'
        zero_records = "Aucune variété n'est cultivée dans ce jardin"
        ajax = True
        model = Culture
        attrs = {'class': 's5-table table-hover table-striped'}
Пример #7
0
class ProjectTable(Table):

    view = LinkColumn(
        header='View',
        links=[
            Link(
                text='',
                viewname='project-detail',
                args=(A('id'), ),
                attrs={'class': 'glyphicon glyphicon-eye-open'},
            ),
        ],
        searchable=False,
        sortable=False,
    )

    title = CustomNoneColumn(field='title', header='Title')
    status = TagColumn(field='ajax_status',
                       header='Status',
                       wrap_class='task-status',
                       attrs=center_attrs)
    completion = Column(field='ajax_completion', header='Completion')
    deadline = NoneableDatetimeColumn(field='deadline',
                                      header='Deadline',
                                      format=date_time_format)
    notes = BleachTrimColumn(field='notes', trim_count=250, header='Notes')

    class Meta:
        model = Project
        search = True
        ajax = True
        ajax_source = reverse_lazy('data-project')

        attrs = {'class': 'table-striped table-hover'}
Пример #8
0
class MenuplanTable(Table):
    name = Column(field='name', header='Name')
    creationDate = Column(field='creationDate', header='Creation Date')
    links = LinkColumn(
        header='Actions',
        links=[
            Link(text='Open', viewname='menuplans.detail', args=(A('pk'), ))
        ]
    )
Пример #9
0
class UserleadersTable(Table):
#'leader__name','user__mobile_number','user__aadhar_number','create_date','last_modified'
	user__name = LinkColumn(field='user__name',header=u'Member Name', links=[Link(text=A('user__name'), viewname='leaders Group List Template View', args=(A('user_id',),))])
	user__mobile_number = Column(field='user__mobile_number', header=u'Mobile Number', attrs={'class': 'custom'})
	user__aadhar_number = Column(field='user__aadhar_number', header=u'QR Code', attrs={'class': 'custom'})
	create_date = Column(field='create_date', header=u'Added Date', attrs={'class': 'custom'})
	last_modified = Column(field='last_modified', header=u'Last Modified date', attrs={'class': 'custom'})
	class Meta:
		model = Userleaders
		info_format = u"Total: _TOTAL_  First: _START_  Last: _END_"
Пример #10
0
class ProfilJardinTable(Table):
    appelation = Column(field='appelation', header='Appelation')
    proprietaire = LinkColumn(field='proprietaire',
                              header='Proprietaire',
                              links=[
                                  Link(text=A('proprietaire.user.first_name'),
                                       viewname='s5appadherant:profil_detail',
                                       args=(A('proprietaire.id'), ))
                              ])
    commune = Column(field='adresse.commune', header='Commune')
    exposition = Column(field='exposition', header='Exposition')
    type_sol = Column(field='type_sol', header='Type de sol')
    irrigation = Column(field='irrigation', header='Irrigation')
    superficie = Column(field='superficie', header='Superficie')
    mise_en_culture = Column(field='mise_en_culture', header='Mise en culture')
    action = LinkColumn(header='Action',
                        sortable=False,
                        links=[
                            Link(text='Détail',
                                 viewname='s5appadherant:jardin_detail',
                                 args=(A('id'), ))
                        ])

    def __init__(self, *args, **kwargs):
        adherant = kwargs.pop('adherant', None)
        if not isinstance(adherant, Adherant):
            raise ValueError(u'ProfilJardinTable: aucun adhérant défini')

        super(ProfilJardinTable, self).__init__(*args, **kwargs)

        self.opts.ajax_source = reverse_lazy(
            's5appadherant:profil_jardin_data',
            kwargs={'adherant_id': adherant.id})
        self.addons.pagination.length = 5

    class Meta:
        search = False
        pagination_next = 'Suivant'
        pagination_prev = 'Précédent'
        zero_records = "Aucun jardin cultivé"
        ajax = True
        model = Jardin
        attrs = {'class': 's5-table table-hover table-striped'}
Пример #11
0
class DatasetListTable(Table):
    id = Column(field='id', header='ID')
    name = Column(field='name', header='Dataset')
    status = DatasetStatusColumn(field='processing_finished', header='Status',
                                 links=[Link(text='View', viewname='dataset-detail', args=(Accessor('pk'),))])
    errors = ProcessingErrorColumn(header='', searchable=False, sortable=False)

    class Meta:
        model = Dataset
        ajax = True
        sort = [(0, 'desc')]
Пример #12
0
class ArchivoTable(Table):
    number = Column(field='number', header=u'Numero de Archivo')
    status = Column(field='status', header=u'Estado')
    actual_time = Column(field='actual_time', header=u'Tiempo en Proceso')
    total_time = Column(field='accumulated_time', header=u'Tiempo Total')
    ver = LinkColumn(header=u'Detalles',
                     links=[
                         Link(text=u'Ver',
                              viewname='dashboard_file_check2',
                              args=(A('number'), ))
                     ],
                     sortable=False)
Пример #13
0
class SpectraTable(Table):
    inventory_id = Column(field='standard.inventory_id', header='Inventory ID')
    molecule = Column(field='standard.molecule.name', header='Molecule')
    precursor_mz = MzColumn(field='precursor_mz', header='Precursor m/z')
    adduct = AdductColumn(field='adduct.delta_formula', header='Adduct')
    view = LinkColumn(header='', sortable=False, searchable=False,
                      links=[Link(text='View', viewname='fragmentSpectrum-detail', kwargs={'pk': Accessor('pk')})])

    class Meta:
        model = FragmentationSpectrum
        ajax = True
        ajax_source = reverse_lazy('spectra_table')
        sort = [(0, 'asc')]
Пример #14
0
class TaskLinkMixin(Table):

    view = LinkColumn(
        header='View',
        links=[
            Link(
                text='',
                viewname='task-detail',
                args=(A('id'), ),
                attrs={'class': 'glyphicon glyphicon-eye-open'},
            ),
        ],
        searchable=False,
        sortable=False,
    )
Пример #15
0
class TicketTable(Table):
    id = LinkColumn(header='Id',
                    links=[
                        Link(text=A('id'), viewname='issue', args=(A('id'), )),
                    ])
    creator = Column(field='creator', header='Creador')
    user = Column(field='user', header='Asignado')
    name = Column(field='name', header='Nombre')
    dateraised = Column(field='dateraised', header='Emisión')
    datesolved = Column(field='datesolved', header='Solucionado')
    priority = Column(field='priority', header='Prioridad')
    state = Column(field='state', header='Estado')
    escalated = Column(field='escalated', header='Escalado')
    hidden = Column(field='hidden', header='Archivada')

    class Meta:
        model = Ticket
Пример #16
0
class ContactViewMixin(Table):
    """
    A link to a contact
    """
    view = LinkColumn(
        header='View',
        links=[
            Link(
                text='',
                viewname='contact-detail',
                args=(A('id'), ),
                attrs={'class': 'glyphicon glyphicon-eye-open'},
            ),
        ],
        searchable=False,
        sortable=False,
    )
Пример #17
0
class adm_infoTable(Table):
    username = Column(field='User.username', header='IT Name')
    #site = Column(field='site', header='Site Name')
    pc_dispose = Column(field='pc_dispose', header='PC-Dispose')
    stat_adm = Column(field='stat_adm', header='Stat Admin')
    it_adm = Column(field='it_adm', header='IT Admin')
    system_adm = Column(field='system_adm', header='System Admin')
    OP = LinkColumn(header=u'操作',
                    sortable=False,
                    links=[
                        Link(text=u'详细',
                             viewname='sitepermission',
                             args=(A('User.id'), )),
                    ])

    class Meta:
        model = adm_info
Пример #18
0
class GeneLocationTable(Table):
    gene_id = LinkColumn(field='gene_id',
                         header="SmLINC",
                         links=[
                             Link(text=A('gene_id'),
                                  viewname="sm_view",
                                  kwargs={"gene_id": A('gene_id')})
                         ])
    chromosome = Column(field='chromosome', header="Chromosome")
    chromosome_start = Column(field='chromosome_start',
                              header="Chromosome Start")
    chromosome_end = Column(field='chromosome_end', header="Chromosome End")
    strand = Column(field='strand', header="Strand")
    block_counts = Column(field='block_counts', header="# of Exons")

    class Meta:
        model = GeneLocation
        search_placeholder = "Search for your SmLINC"
Пример #19
0
class ProjectAssocViewMixin(Table):
    view =  LinkColumn(
        header='View', 
        links=[
            Link(
                text='',
                viewname='project-detail', 
                args=(
                    A('proj.id'),
                ),
                attrs={
                    'class':
                        'glyphicon glyphicon-eye-open'
                },
            ),
        ],
        searchable=False,
        sortable=False,
    )
Пример #20
0
class UserPeopleTable(Table):

	people__first_name = LinkColumn(field='people__first_name',header=u'Name', links=[Link(text=A('people__first_name'), viewname='people choose View', args=(A('people_id',),))], header_attrs={'width':'20%'})
	people__last_name = Column(field='people__last_name', header=u'Last Name', attrs={'class': 'custom'}, header_attrs={'width':'20%'})
	user__mobile_number = Column(field='people__mobile_number', header=u'Mobile Number', attrs={'class': 'custom'}, header_attrs={'width':'20%'})
	user__aadhar_number = Column(field='people__aadhar_number', header=u'Aadhar Number', attrs={'class': 'custom'}, header_attrs={'width':'20%'})
	people__house_number = Column(field='people__house_number', header=u'House Number', attrs={'class': 'custom'}, header_attrs={'width':'20%'})
	people__village = Column(field='people__village', header=u'Village', attrs={'class': 'custom'}, header_attrs={'width':'20%'})
	people__sub_district_or_mandal = Column(field='people__sub_district_or_mandal', header=u'Mandal', attrs={'class': 'custom'}, header_attrs={'width':'20%'})
	people__district = Column(field='people__district', header=u'District', attrs={'class': 'custom'}, header_attrs={'width':'20%'})
	people__city_name = Column(field='people__city_name', header=u'City Name', attrs={'class': 'custom'}, header_attrs={'width':'20%'})
	people__state_name = Column(field='people__state_name', header=u'State Name', attrs={'class': 'custom'}, header_attrs={'width':'20%'})
	people__pincode = Column(field='people__pincode', header=u'Pincode', attrs={'class': 'custom'}, header_attrs={'width':'20%'})
	created_date = Column(field='created_date', header=u'Created Date', attrs={'class': 'custom'}, header_attrs={'width':'20%'})
	date_modified = Column(field='date_modified', header=u'Last Modified Date', attrs={'class': 'custom'}, header_attrs={'width':'20%'})
	class Meta:
		model = UserPeople
		info_format = u"Total: _TOTAL_  First: _START_  Last: _END_"
		sort = [(0, 'asc'), (1, 'desc')]
		pagination = True
Пример #21
0
class User_listTable(Table):
    id = Column(field='id', header='ID')
    user_name = Column(field='user_name', header='User Name')
    full_name = Column(field='full_name', header='Full Name')
    email_address = Column(field='email_address', header='Email')
    bl_list = Column(field='dept_list.bl_list', header='BL')
    dept_list = Column(field='dept_list', header='Department')
    Regdate = Column(field='regdate', header='RegisterDate')
    # resigndate = Column(field='resigndate', header='ResignDate')
    lastupdate = Column(field='lastupdate', header='Last Update')
    #user_status = Column(field='user_status',header='Status')
    OP = LinkColumn(header=u'操作',
                    sortable=False,
                    links=[
                        Link(text=u'详细',
                             viewname='userdetailtable2',
                             args=(A('id'), )),
                    ])

    class Meta:
        model = user_list
        ext_button = True
        template_name = 'table/buttons_table.html'
Пример #22
0
class ProjectAssocAjaxTable(Table):
    """
    Meant to be used from the "perspective" of a single Contact.
    Displays the associated projects, and the Contact's role in each.
    """
    view = LinkColumn(
        header='View',
        links=[
            Link(
                text='',
                viewname='project-detail',
                args=(A('id'), ),
                attrs={'class': 'glyphicon glyphicon-eye-open'},
            ),
        ],
        searchable=False,
        sortable=False,
    )

    title = CustomNoneColumn(field='title', header='Title')
    role = TagColumn(field='ajax_tag_type',
                     header='Role',
                     wrap_class='con-task-assoc')
    deadline = NoneableDatetimeColumn(field='deadline',
                                      header='Deadline',
                                      format=date_time_format)
    status = TagColumn(field='status',
                       header='Status',
                       wrap_class='task-status',
                       attrs=center_attrs)

    class Meta:
        model = Project
        search = True
        ajax = True

        attrs = {'class': 'table-striped table-hover'}
Пример #23
0
class GroupmemberLeaderTable(Table):
	member__first_name = LinkColumn(field='member__first_name',header=u'Member Name', links=[Link(text=A('member__first_name'), viewname='leaders-member_schoose_view', args=(A('member_id',),A('user_group_id',),))])
	#member__first_name = Column(field='member__first_name', header=u'Member Name', attrs={'class': 'custom'})
	user_group__name = Column(field='user_group__name', header=u'Group Name', attrs={'class': 'custom'})
	member__mobile_number = Column(field='member__mobile_number', header=u'Mobile Number', attrs={'class': 'custom'})
	member__aadhar_number = Column(field='member__aadhar_number', header=u'QR Code', attrs={'class': 'custom'})
	created_date = Column(field='created_date', header=u'Added Date', attrs={'class': 'custom'})
	class Meta:
		model = Groupmember
		info_format = u"Total: _TOTAL_  First: _START_  Last: _END_"
Пример #24
0
class GroupmemberTable(Table):
	member__first_name = LinkColumn(field='member__first_name',header=u'Member Name', links=[Link(text=A('member__first_name'), viewname='choose View', args=(A('member_id',),A('user_group_id',),))])
	member__last_name = Column(field='member__last_name', header=u'Last Name')
	member__latitude = Column(field='member__latitude', header=u'Latitude')
	member__longitude = Column(field='member__longitude', header=u'Longitude')
	member__house_number = Column(field='member__house_number', header=u'House Number')
	member__village = Column(field='member__village', header=u'Village')
	member__sub_district_or_mandal = Column(field='member__sub_district_or_mandal', header=u'Mandal')
	member__district = Column(field='member__district', header=u'District')
	member__city_name = Column(field='member__city_name', header=u'City Name')
	member__state_name = Column(field='member__state_name', header=u'State Name')
	member__country_name = Column(field='member__country_name', header=u'Country Name')
	member__pincode = Column(field='member__pincode', header=u'Pincode')
	user_group__name = Column(field='user_group__name', header=u'Group Name')
	member__mobile_number = Column(field='member__mobile_number', header=u'Mobile Number')
	member__aadhar_number = Column(field='member__aadhar_number', header=u'QR Code')
	created_date = Column(field='created_date', header=u'Added Date')
	class Meta:
		model = Groupmember
		info_format = u"Total: _TOTAL_  First: _START_  Last: _END_"
Пример #25
0
class SellProductListTable(Table):
	product_name = LinkColumn(field='product_name',header=u'Product Name',header_attrs={'width': '1%'}, links=[Link(text=A('product_name'), viewname='people-product-sell-list', args=(A('product_image',),A('create_date',),))])
	#product_name = Column(field='product_name', header=u'Product Name', attrs={'class': 'custom'}, header_attrs={'width': '1%'})	
	create_date = Column(field='create_date', header=u'Added Date', attrs={'class': 'custom'}, header_attrs={'width': '1%'})
	dcount = Column(field='dcount', header=u'Count', attrs={'class': 'custom'}, header_attrs={'width': '1%'})
Пример #26
0
class RecipeTable(Table):
    name = Column(field='name', header='Name')
    links = LinkColumn(
        header='Actions',
        links=[Link(text='Edit', viewname='recipes.detail', args=(A('pk'), ))])