Default bootstrap tables

* adds basic bootstrap classes to BaseTable model
This commit is contained in:
mipel 2021-07-20 14:23:16 +02:00
parent 596d61f667
commit 6ac0556601
5 changed files with 39 additions and 9 deletions

View File

@ -26,9 +26,10 @@ class Intervention(BaseObject):
registration_file_number = models.CharField(max_length=1000, blank=True, null=True)
conservation_office = models.ForeignKey(Organisation, on_delete=models.SET_NULL, null=True, related_name="+")
conservations_file_number = models.CharField(max_length=1000, blank=True, null=True)
process_type = models.CharField(max_length=500, null=True, blank=True)
law = models.CharField(max_length=500, null=True, blank=True)
handler = models.CharField(max_length=500, null=True, blank=True)
handler = models.CharField(max_length=500, null=True, blank=True, help_text="Who is responsible for this intervention?")
geometry = models.ForeignKey(Geometry, null=True, blank=True, on_delete=models.SET_NULL)
documents = models.ManyToManyField("konova.Document", blank=True)

View File

@ -25,17 +25,34 @@ class InterventionTable(BaseTable):
orderable=True,
accessor="title",
)
d = tables.Column(
verbose_name=_("Created on"),
c = tables.Column(
verbose_name=_("Checked"),
orderable=True,
accessor="recorded_on",
)
r = tables.Column(
verbose_name=_("Registered"),
orderable=True,
accessor="recorded_on",
)
lm = tables.Column(
verbose_name=_("Last edit"),
orderable=True,
accessor="created_on",
)
"""
# ToDo: Decide to keep actions column or to dismiss them
ac = tables.Column(
verbose_name=_("Actions"),
orderable=False,
empty_values=[],
attrs={"td": {"class": "action-col"}}
)
"""
class Meta(BaseTable.Meta):
pass
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

View File

@ -25,6 +25,11 @@ class BaseTable(tables.tables.Table):
add_new_url = None
title = None
class Meta:
attrs = {
"class": "table table-hover",
}
def __init__(self, request: HttpRequest = None, filter_set=None, queryset=None, *args, **kwargs):
self.user = request.user or None
if filter_set is not None:

View File

@ -9,7 +9,7 @@ django-debug-toolbar==3.1.1
django-filter==2.4.0
django-fontawesome-5==1.0.18
django-simple-sso==0.14.1
django-tables2==2.3.3
django-tables2==2.3.4
idna==2.10
importlib-metadata==2.1.1
itsdangerous==1.1.0

View File

@ -20,6 +20,10 @@
</div>
{% endif %}
</div>
{% comment %}
Search input and rpp selector
{% endcomment %}
<div class="row my-1">
<div class="col-sm-12 col-md">
<form method="get" action="{{table.filter}}">
@ -49,9 +53,12 @@
</div>
</div>
</div>
&nbsp;
</div>
{% comment %}
Filter section
{% endcomment %}
<div class="row">
<div class="col-md">
<div class="card">
@ -72,7 +79,7 @@
</div>
</div>
</div>
<div class="table-container">
{% render_table table %}
</div>
{% comment %}
Table section
{% endcomment %}
{% render_table table %}