# HG changeset patch # User Peter Sanchez # Date 1289285484 28800 # Mon Nov 08 22:51:24 2010 -0800 # Node ID 6b4ef36644735a8aae45d77d47f5f061b250c8a6 # Parent ff10ecd1340958f3da3a9337a513ef2a94f03b30 Fixed bugs in templatetags, admin, models and sync_twitter_accounts command diff --git a/twittersync/admin.py b/twittersync/admin.py --- a/twittersync/admin.py +++ b/twittersync/admin.py @@ -14,7 +14,7 @@ class TwitterStatusAdmin(admin.ModelAdmin): - list_display = ('author__screen_name', 'content', 'created_date',) + list_display = ('author', 'content', 'created_date',) fields = ('author', 'status_id', 'content', 'created_date', 'date') readonly_fields = ( 'author', 'status_id', 'content', 'created_date', 'date', diff --git a/twittersync/helpers.py b/twittersync/helpers.py --- a/twittersync/helpers.py +++ b/twittersync/helpers.py @@ -46,4 +46,4 @@ res = opener.open(build_url(qdict)) results = json.load(res) for result in results: - save_status_update(result) + save_status_update(account, result) diff --git a/twittersync/management/commands/sync_twitter_accounts.py b/twittersync/management/commands/sync_twitter_accounts.py --- a/twittersync/management/commands/sync_twitter_accounts.py +++ b/twittersync/management/commands/sync_twitter_accounts.py @@ -12,4 +12,4 @@ def handle_noargs(self, **options): for account in TwitterAccount.objects.filter(is_active=True): - self.sync_twitter_account(account) + sync_twitter_account(account) diff --git a/twittersync/models.py b/twittersync/models.py --- a/twittersync/models.py +++ b/twittersync/models.py @@ -28,6 +28,8 @@ class Meta: ordering = ('screen_name',) + verbose_name = 'Twitter Account' + verbose_name_plural = 'Twitter Accounts' def __unicode__(self): return u'Twitter Account: %s' % self.screen_name @@ -39,7 +41,7 @@ def save(self, *args, **kwargs): if self.id: self.updated = datetime.datetime.now() - super(Entry, self).save(*args, **kwargs) + super(TwitterAccount, self).save(*args, **kwargs) class TwitterStatus(models.Model): @@ -54,7 +56,9 @@ class Meta: get_latest_by = 'created_date' - ordering = ('-date',) + ordering = ('-created_date',) + verbose_name = 'Twitter Status' + verbose_name_plural = 'Twitter Statuses' def __unicode__(self): return u'%i' % self.id diff --git a/twittersync/templatetags/twittersync_tags.py b/twittersync/templatetags/twittersync_tags.py --- a/twittersync/templatetags/twittersync_tags.py +++ b/twittersync/templatetags/twittersync_tags.py @@ -27,7 +27,8 @@ except TwitterAccount.DoesNotExist: raise - context[varname] = account.tweets.all()[:limit] + context[varname] = account.tweets.all()[:int(limit)] + return u'' @register.tag @@ -46,6 +47,7 @@ settings.TWITTERSYNC_LATEST_TWEETS. If that isn't set, we fall back to 5 ''' + bits = token.split_contents() if len(bits) < 4: raise template.TemplateSyntaxError( '"%s" tag takes at least 3 arguments' % bits[0]