diff options
author | Filipp Lepalaan <filipp@mac.com> | 2016-02-29 12:16:09 +0200 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2016-02-29 12:16:09 +0200 |
commit | ce705c3cef767803700629d9598a2ebaff14687d (patch) | |
tree | b74320afc9dbfa257bf2f1ad45784caa536910fc /servo/models/common.py | |
parent | 27978c9011196be5a47933eb62efb3ddab17f328 (diff) | |
download | Servo-ce705c3cef767803700629d9598a2ebaff14687d.tar.gz Servo-ce705c3cef767803700629d9598a2ebaff14687d.tar.bz2 Servo-ce705c3cef767803700629d9598a2ebaff14687d.zip |
Added timezone field for GSX accounts
To simplify connections (no need for location or user account)
Diffstat (limited to 'servo/models/common.py')
-rw-r--r-- | servo/models/common.py | 29 |
1 files changed, 24 insertions, 5 deletions
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( @@ -240,6 +247,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): """ Returns the correct GSX account for |