Skip to content

Commit

Permalink
web - fixed displaying of empty names, minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
superstes committed Apr 18, 2021
1 parent e3ebb5e commit 901acce
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

### DISCLAIMOR ###
### DISCLAIMER ###

I have little experience with the django framework, the mvc software design, UI-design and web-development itself.

Expand Down
8 changes: 7 additions & 1 deletion code/web/base/ga/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ class BaseModel(BareModel):
description = models.CharField(max_length=255, blank=True, null=True, default=None)

def __str__(self):
return f"{self.name} | {self.description}"
if self.description is not None:
out = f'{self.name} | {self.description}'

else:
out = f'{self.name}'

return out

class Meta:
abstract = True
Expand Down
8 changes: 8 additions & 0 deletions code/web/base/ga/templatetags/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,3 +299,11 @@ def beta_mode(nope: None) -> bool:
@register.filter
def get_version(nope: None) -> float:
return VERSION


@register.filter
def empty_if_none(check: str) -> str:
if check in [None, 'None']:
return ''

return check
5 changes: 1 addition & 4 deletions code/web/base/static/css/ga.css
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,8 @@ body {
border-radius: 3px;
}

.ga-chart {
.ga-chart-config {
position: relative;
}

.ga-chart-main {
height: 45vh;
width: 90vw;
margin: 3vh auto;
Expand Down

0 comments on commit 901acce

Please sign in to comment.