Intervention tables and model adjustments

* adds user access relation to certain models
* adds pagination to tables
* adds checked_on/_by attributes to intervention model
* adds custom column rendering for checked and registered columns
* adds first simple index filtering of default interventions for user
* adds translations
This commit is contained in:
mipel
2021-07-21 15:40:34 +02:00
parent 704137216f
commit d139119a15
10 changed files with 170 additions and 43 deletions

View File

@@ -35,9 +35,9 @@ class BaseObject(BaseResource):
"""
identifier = models.CharField(max_length=1000, null=True, blank=True)
title = models.CharField(max_length=1000, null=True, blank=True)
deleted_on = models.DateTimeField(null=True)
deleted_by = models.ForeignKey(User, null=True, on_delete=models.SET_NULL, related_name="+")
comment = models.TextField()
deleted_on = models.DateTimeField(null=True, blank=True)
deleted_by = models.ForeignKey(User, null=True, blank=True, on_delete=models.SET_NULL, related_name="+")
comment = models.TextField(null=True, blank=True)
class Meta:
abstract = True

View File

@@ -72,7 +72,7 @@ a {
text-decoration: none;
}
nav{
.navbar{
background-color: var(--rlp-red);
}
@@ -144,9 +144,35 @@ nav{
cursor: pointer;
}
.dropdown-item.selected{
background-color: var(--rlp-gray-light);
}
input:focus, textarea:focus, select:focus{
border: 1px solid var(--rlp-red) !important;
box-shadow: 0 0 3px var(--rlp-red) !important;
-moz-box-shadow: 0 0 3px var(--rlp-red) !important;
-webkit-box-shadow: 0 0 3px var(--rlp-red) !important;
}
.check-star{
color: goldenrod;
}
.registered-bookmark{
color: green;
}
/* PAGINATION */
.page-item > .page-link{
color: var(--rlp-red);
}
.page-link:focus{
border: 1px solid var(--rlp-red) !important;
box-shadow: 0 0 3px var(--rlp-red) !important;
-moz-box-shadow: 0 0 3px var(--rlp-red) !important;
-webkit-box-shadow: 0 0 3px var(--rlp-red) !important;
}
.page-item.active > .page-link{
background-color: var(--rlp-red);
border-color: var(--rlp-red);
}

View File

@@ -144,7 +144,7 @@ AUTH_PASSWORD_VALIDATORS = [
LANGUAGE_CODE = 'en-us'
DEFAULT_DATE_TIME_FORMAT = 'YYYY-MM-DD hh:mm:ss'
DEFAULT_DATE_TIME_FORMAT = '%d.%m.%Y %H:%M:%S'
TIME_ZONE = 'Europe/Berlin'

View File

@@ -104,6 +104,28 @@ class BaseTable(tables.tables.Table):
icon
)
def render_checked_star(self, tooltip: str = None, icn_filled: bool = False):
"""
Returns a star icon
"""
icon = "fas fa-star check-star" if icn_filled else "far fa-star"
return format_html(
"<em title='{}' class='{}'></em>",
tooltip,
icon
)
def render_bookmark(self, tooltip: str = None, icn_filled: bool = False):
"""
Returns a bookmark icon
"""
icon = "fas fa-bookmark registered-bookmark" if icn_filled else "far fa-bookmark"
return format_html(
"<em title='{}' class='{}'></em>",
tooltip,
icon
)
class ChoicesColumnForm(BaseForm):
select = forms.ChoiceField(