Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardobranco777 committed Jul 3, 2023
1 parent 52bb8e5 commit 4376ba0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
11 changes: 5 additions & 6 deletions ocw/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def __ne__(self, other):
return not self == other


class ProviderChoice(ChoiceEnum):
class ProviderChoice(ChoiceEnum) -> str:
GCE = 'Google'
EC2 = 'EC2'
AZURE = 'Azure'
Expand All @@ -26,14 +26,13 @@ class ProviderChoice(ChoiceEnum):
def from_str(provider):
if provider.upper() == ProviderChoice.GCE:
return ProviderChoice.GCE
elif provider.upper() == ProviderChoice.EC2:
if provider.upper() == ProviderChoice.EC2:
return ProviderChoice.EC2
elif provider.upper() == ProviderChoice.AZURE:
if provider.upper() == ProviderChoice.AZURE:
return ProviderChoice.AZURE
elif provider.upper() == ProviderChoice.OSTACK:
if provider.upper() == ProviderChoice.OSTACK:
return ProviderChoice.OSTACK
else:
raise ValueError(f"{provider} is not convertable to ProviderChoice")
raise ValueError(f"{provider} is not convertable to ProviderChoice")


class StateChoice(ChoiceEnum):
Expand Down
4 changes: 2 additions & 2 deletions ocw/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ def all_time_fields(self):
all_time_pattern = "(age={}, first_seen={}, last_seen={}, ttl={})"
first_fmt = 'None'
last_fmt = 'None'
if (self.first_seen):
if self.first_seen:
first_fmt = self.first_seen.strftime('%Y-%m-%d %H:%M')
if (self.last_seen):
if self.last_seen:
last_fmt = self.last_seen.strftime('%Y-%m-%d %H:%M')
return all_time_pattern.format(self.age_formated(), first_fmt, last_fmt, self.ttl_formated())

Expand Down
3 changes: 1 addition & 2 deletions ocw/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ def render(self, value, record, bound_column):
if value:
return format_html('<img alt="Email notification was send" src="{}" width=20 height=20/>',
static('img/notified.png'))
else:
return ""
return ""


class TagsColumn(tables.TemplateColumn):
Expand Down

0 comments on commit 4376ba0

Please sign in to comment.