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>')
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%'}
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
class MedExaminationsTable(tables.Table): patient = tables.LinkColumn('patient-detail', args=[A('patient_id')]) patient_status = tables.LinkColumn('renew-status-medexamination', args=[A('mid')]) email = tables.EmailColumn() #purpose_medical_examination=tables.Column() class Meta: model = MedExamtList template_name = 'django_tables2/bootstrap.html' fields = ('patient', 'patient_status', 'email', 'phone_mobile', 'purpose_medical_examination', 'date_medical_examination', 'dat_end', 'date_update') attrs = {"class": "table-striped table-bordered "}
class PatientTables(tables.Table): patient = tables.LinkColumn('patient-detail', args=[A('pid')]) email = tables.EmailColumn() class Meta: model = PatientList template_name = 'django_tables2/bootstrap.html' # add class="paleblue" to <table> tag #attrs = {'class': 'paleblue'} #fields = ('first_name', 'addr_city', 'phone_mobile') attrs = {"class": "table-striped table-bordered "}
class EmailTable(tables.Table): email = tables.EmailColumn( accessor='email', verbose_name=_("Email"), ) class Meta: attrs = { "class": "table table-bordered table-condensed content-box gs-profile" }
class ClientTable(tables.Table): """product table""" # DETAIL_URL_NAME = 'clients' # id = tables.LinkColumn(DETAIL_URL_NAME, args=[A('uuid')]) email = tables.EmailColumn() phone_number = tables.Column() class Meta: model = Clients fields = ('pk','first_name','last_name','email','phone_number','status','user_type') attrs={ "class": "table table-bordered table-condensed table-hover", }
class CaspUserTable(tables.Table): username = tables.LinkColumn(verbose_name='Usuario', viewname='perms-user-detail', args=[A('pk')]) name = tables.Column(verbose_name='Nombre', accessor=A('get_full_name'), orderable=False) email = tables.EmailColumn(verbose_name='Email') class Meta: model = CaspUser fields = ('username', 'name', 'email') attrs = {"class": "paleblue table table-striped"} template = 'django-tables2/bootstrap-base.html'
class Meta: model = Person email = tables.EmailColumn() name = tables.URLColumn() order_by = '-name' name = tables.Column(footer='Total:') template = 'django_tables2/bootstrap.html' fields = [ 'name', 'company', 'email', 'phone', ]
class CompanyUserTable(tables.Table): Name = tables.Column(accessor='user.get_full_name', verbose_name='Name') Email = tables.EmailColumn(accessor='user.email') Active = tables.BooleanColumn(accessor='user.is_active', ) Role = tables.ManyToManyColumn(accessor='user.groups', verbose_name='Role') class Meta: model = UserProfile exclude = ( 'id', 'updated_at', 'created_at', 'company', 'user', ) attrs = {'class': 'table table-responsive table-hover'}
class MedExaminationsTable(tables.Table): id = tables.LinkColumn('patient-detail', args=[A('patient_id')]) patient_status = tables.LinkColumn('renew-status-medexamination', args=[A('id')]) #patient_status=tables.Column(accessor='patient_status') first_name = tables.Column(accessor='patient.first_name') last_name = tables.Column(accessor='patient.last_name') addr_city = tables.Column(accessor='patient.addr_city') phone_mobile = tables.Column(accessor='patient.phone_mobile') inn = tables.Column(accessor='patient.inn') email=tables.EmailColumn(accessor='patient.email') class Meta: model=MedExamination template_name = 'django_tables2/bootstrap.html' # add class="paleblue" to <table> tag #attrs = {'class': 'paleblue'} fields = ('id','patient_status','first_name','last_name','addr_city','phone_mobile','email','inn','date_medical_examination','dat_end','purpose_medical_examination') attrs = {"class": "table-striped table-bordered "} per_page: 25
class Table(tables.Table): email = tables.EmailColumn(default="---")
class Table(tables.Table): email = tables.EmailColumn()
class Table(tables.Table): email = tables.EmailColumn(text="@")
class EmailReportTable(tables.Table): email_message = tables.Column(verbose_name='Email') from_email = tables.Column(verbose_name="From") to_email = tables.EmailColumn(verbose_name="To") msg_status = tables.Column(verbose_name='Status') sent_at = tables.Column( verbose_name="Sent", attrs={'td': { 'style': 'min-width:100px; font-size: 9pt;' }}) activity = tables.Column( verbose_name="Activity", accessor='pk', attrs={'td': { 'style': 'width:130px; white-space: nowrap' }}) def __init__(self, *args, **kwargs): self.utz = kwargs.pop('utz') super(EmailReportTable, self).__init__(*args, **kwargs) @cached_as(timeout=120) def render_activity(self, record): ev_open = EmailReceiverAction.objects.filter( email_delivery_report=record.pk, action='1') ev_click = EmailReceiverAction.objects.filter( email_delivery_report=record.pk, action='2') ev_spam_report = EmailReceiverAction.objects.filter( email_delivery_report=record.pk, action='7') return format_html( '' + '<span data-tooltip aria-haspopup="true" class="has-tip circle ' + ("kt-e-activity-open" if ev_open else "kt-e-inactivity") + '" title="Open: {}">O</span>' + '<span data-tooltip aria-haspopup="true" class="has-tip circle ' + ("kt-e-activity-click" if ev_click else "kt-e-inactivity") + '" title="Click: {}">C</span>' + '<span data-tooltip aria-haspopup="true" class="has-tip circle ' + ("kt-e-activity-spamr" if ev_spam_report else "kt-e-inactivity") + '" title="Spam Report: {}">R</span>', "" if not ev_open else (arrow.get(ev_open[0].action_time).to( self.utz).format('DD-MM-YYYY HH:mm')), "" if not ev_click else (arrow.get(ev_click[0].action_time).to( self.utz).format('DD-MM-YYYY HH:mm')), "" if not ev_spam_report else (arrow.get(ev_spam_report[0].action_time).to( self.utz).format('DD-MM-YYYY HH:mm'))) def render_email_message(self, record): return format_html( '<a href="#">{}</a>', text_2_wordlist(html_to_text(record.email_message.get('title')), 5)) class Meta: model = EmailDeliveryReport fields = ('email_message', 'from_email', 'to_email', 'msg_status', 'sent_at', 'activity') empty_text = 'There are no Reports to display.' attrs = {'style': 'width: 100%'}