From ce705c3cef767803700629d9598a2ebaff14687d Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Mon, 29 Feb 2016 12:16:09 +0200 Subject: Added timezone field for GSX accounts To simplify connections (no need for location or user account) --- servo/models/common.py | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'servo/models') diff --git a/servo/models/common.py b/servo/models/common.py index 4ca1ff8..4d91296 100644 --- a/servo/models/common.py +++ b/servo/models/common.py @@ -182,17 +182,24 @@ class GsxAccount(models.Model): sold_to = models.CharField(max_length=10, verbose_name=_("Sold-To")) ship_to = models.CharField(max_length=10, verbose_name=_("Ship-To")) + user_id = models.CharField( + blank=True, + default='', + max_length=128, + verbose_name=_("User ID") + ) + region = models.CharField( max_length=3, choices=gsxws.GSX_REGIONS, verbose_name=_("Region") ) - user_id = models.CharField( - blank=True, - default='', - max_length=128, - verbose_name=_("User ID") + timezone = models.CharField( + max_length=4, + default='CEST', + verbose_name=_('Timezone'), + choices=gsxws.GSX_TIMEZONES ) environment = models.CharField( @@ -239,6 +246,18 @@ class GsxAccount(models.Model): return act + @classmethod + def fallback(cls): + """ + Connect to fallback GSX account + """ + act = cls.get_default_account() + gsxws.connect(user_id=act.user_id, + sold_to=act.sold_to, + timezone=act.timezone, + environment=act.environment,) + return act + @classmethod def default(cls, user, queue=None): """ -- cgit v1.2.3