mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-23 06:39:25 +00:00
Abstract out update command instead of being embedded in save, added cron
This commit is contained in:
@@ -21,7 +21,7 @@ class RedditAccount(models.Model):
|
||||
|
||||
last_update = models.DateTimeField("Last Update from API", blank=False)
|
||||
|
||||
def save(self):
|
||||
def api_update(self):
|
||||
try:
|
||||
jsondoc = json.load(urllib.urlopen("http://reddit.com/user/%s/about.json" % self.username))
|
||||
except:
|
||||
@@ -35,8 +35,6 @@ class RedditAccount(models.Model):
|
||||
self.date_created = datetime.fromtimestamp(data['created_utc'])
|
||||
|
||||
self.last_update = datetime.now()
|
||||
|
||||
return models.Model.save(self)
|
||||
|
||||
class Meta:
|
||||
app_label = 'reddit'
|
||||
|
||||
Reference in New Issue
Block a user