mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 14:52:15 +00:00
Small bits of documentation for the Reddit app
This commit is contained in:
@@ -4,6 +4,8 @@ from django.contrib.auth.models import User
|
|||||||
from reddit.models import RedditAccount
|
from reddit.models import RedditAccount
|
||||||
|
|
||||||
class RedditAccountForm(forms.ModelForm):
|
class RedditAccountForm(forms.ModelForm):
|
||||||
|
""" Basic Reddit account input form """
|
||||||
|
|
||||||
user = forms.ModelChoiceField(queryset=User.objects.order_by('username'))
|
user = forms.ModelChoiceField(queryset=User.objects.order_by('username'))
|
||||||
username = forms.CharField(label = u'Reddit Username', max_length=64)
|
username = forms.CharField(label = u'Reddit Username', max_length=64)
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ class RedditAccount(models.Model):
|
|||||||
self.last_update = datetime.now()
|
self.last_update = datetime.now()
|
||||||
|
|
||||||
def recent_posts(self):
|
def recent_posts(self):
|
||||||
|
""" Returns the first page of posts visible on the user's profile page """
|
||||||
|
|
||||||
try:
|
try:
|
||||||
jsondoc = json.load(urllib.urlopen("http://reddit.com/user/%s.json" % self.username))
|
jsondoc = json.load(urllib.urlopen("http://reddit.com/user/%s.json" % self.username))
|
||||||
except:
|
except:
|
||||||
|
|||||||
Reference in New Issue
Block a user