From 97188000021fdba8398a14d20e6b01c1e6a5547c Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Sat, 7 Aug 2010 12:32:58 +0100 Subject: [PATCH] Small bits of documentation for the Reddit app --- reddit/forms.py | 2 ++ reddit/models.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/reddit/forms.py b/reddit/forms.py index f9567f3..7ede80b 100644 --- a/reddit/forms.py +++ b/reddit/forms.py @@ -4,6 +4,8 @@ from django.contrib.auth.models import User from reddit.models import RedditAccount class RedditAccountForm(forms.ModelForm): + """ Basic Reddit account input form """ + user = forms.ModelChoiceField(queryset=User.objects.order_by('username')) username = forms.CharField(label = u'Reddit Username', max_length=64) diff --git a/reddit/models.py b/reddit/models.py index 26af106..90b9134 100644 --- a/reddit/models.py +++ b/reddit/models.py @@ -48,6 +48,8 @@ class RedditAccount(models.Model): self.last_update = datetime.now() def recent_posts(self): + """ Returns the first page of posts visible on the user's profile page """ + try: jsondoc = json.load(urllib.urlopen("http://reddit.com/user/%s.json" % self.username)) except: