-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Safe refresh #32
Safe refresh #32
Conversation
field=models.CharField(default='UTC', max_length=128), | ||
preserve_default=False, | ||
), | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brad What do you think about renaming this file to 0006_add_expires_timezone_fields.py
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@percyperez Oh yeah, of course!
@@ -13,6 +13,9 @@ class UserFitbit(models.Model): | |||
access_token = models.TextField() | |||
auth_secret = models.TextField() | |||
refresh_token = models.TextField() | |||
# We will store the timestamp float number as it comes from Fitbit here | |||
expires_at = models.FloatField() | |||
timezone = models.CharField(max_length=128) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brad I see that the migration file for the timezone
field has default='UTC'
. Did you remove default='UTC'
here after the migration file was created? If not, how default='UTC'
was added to the migration file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@percyperez When I ran makemigrations
it asked for a default and I specifie UTC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brad Ah Cool 👍
|
||
|
||
@shared_task | ||
def update_user_timezone(fitbit_user): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Superseded by #33 |
@orcasgit/orcas-developers This has turned out to be a bit of a refactor, but I think refreshing tokens works better now. The changes:
expires_at
andtimezone
fieldstransaction.atomic()
decorator to theget_fitbit_data
method.UserFitbit
object rather than dealing with the session