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 | |
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')
-rw-r--r-- | servo/migrations/0049_gsxaccount_timezone.py | 20 | ||||
-rw-r--r-- | servo/models/common.py | 29 |
2 files changed, 44 insertions, 5 deletions
diff --git a/servo/migrations/0049_gsxaccount_timezone.py b/servo/migrations/0049_gsxaccount_timezone.py new file mode 100644 index 0000000..746a0e1 --- /dev/null +++ b/servo/migrations/0049_gsxaccount_timezone.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.2 on 2016-02-29 09:13 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('servo', '0048_auto_20160225_2328'), + ] + + operations = [ + migrations.AddField( + model_name='gsxaccount', + name='timezone', + field=models.CharField(choices=[(b'PST', b'UTC - 8h (Pacific Standard Time)'), (b'PDT', b'UTC - 7h (Pacific Daylight Time)'), (b'CST', b'UTC - 6h (Central Standard Time)'), (b'CDT', b'UTC - 5h (Central Daylight Time)'), (b'EST', b'UTC - 5h (Eastern Standard Time)'), (b'EDT', b'UTC - 4h (Eastern Daylight Time)'), (b'GMT', b'UTC (Greenwich Mean Time)'), (b'CET', b'UTC + 1h (Central European Time)'), (b'CEST', b'UTC + 2h (Central European Summer Time)'), (b'USZ1', b'UTC + 3h (Kaliningrad Time)'), (b'MSK', b'UTC + 4h (Moscow Time)'), (b'IST', b'UTC + 5.5h (Indian Standard Time)'), (b'YEKST', b'UTC + 6h (Yekaterinburg Time)'), (b'OMSST', b'UTC + 7h (Omsk Time)'), (b'KRAST', b'UTC + 8h (Krasnoyarsk Time)'), (b'CCT', b'UTC + 8h (Chinese Coast Time)'), (b'IRKST', b'UTC + 9h (Irkutsk Time)'), (b'JST', b'UTC + 9h (Japan Standard Time)'), (b'YAKST', b'UTC + 10h (Yakutsk Time)'), (b'AEST', b'UTC + 10h (Australian Eastern Standard Time)'), (b'VLAST', b'UTC + 11h (Vladivostok Time)'), (b'AEDT', b'UTC + 11h (Australian Eastern Daylight Time)'), (b'ACST', b'UTC + 9.5h (Austrailian Central Standard Time)'), (b'ACDT', b'UTC + 10.5h (Australian Central Daylight Time)'), (b'NZST', b'UTC + 12h (New Zealand Standard Time)'), (b'MAGST', b'UTC + 12h (Magadan Time)')], default=b'CEST', max_length=4, verbose_name='Timezone'), + ), + ] 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 |