Improve presentation of model member variables
This commit is contained in:
parent
b2e260475b
commit
b887b8d2ff
2 changed files with 14 additions and 0 deletions
|
|
@ -67,6 +67,12 @@ class Location(Model):
|
|||
self.operator = Operator.find_by_id(self.operator_id)
|
||||
self.available = self.exists(self.country_code, self.code)
|
||||
|
||||
if isinstance(self.is_proxy_capable, int):
|
||||
self.is_proxy_capable = bool(self.is_proxy_capable)
|
||||
|
||||
if isinstance(self.is_wireguard_capable, int):
|
||||
self.is_wireguard_capable = bool(self.is_wireguard_capable)
|
||||
|
||||
def is_available(self):
|
||||
return self.exists(self.country_code, self.code)
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,14 @@ class SubscriptionPlan(Model):
|
|||
features_proxy: bool
|
||||
features_wireguard: bool
|
||||
|
||||
def __post_init__(self):
|
||||
|
||||
if isinstance(self.features_proxy, int):
|
||||
self.features_proxy = bool(self.features_proxy)
|
||||
|
||||
if isinstance(self.features_wireguard, int):
|
||||
self.features_wireguard = bool(self.features_wireguard)
|
||||
|
||||
@staticmethod
|
||||
def find_by_id(id: int):
|
||||
Model._create_table_if_not_exists(table_name=_table_name, table_definition=_table_definition)
|
||||
|
|
|
|||
Loading…
Reference in a new issue