mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 06:42:16 +00:00
Various small fixes for the reddit decouple
This commit is contained in:
@@ -3,10 +3,10 @@ from django import forms
|
||||
from django.contrib.auth.models import User
|
||||
from reddit.models import RedditAccount
|
||||
|
||||
class RedditAccountForm(forms.ModelForm):
|
||||
|
||||
class RedditAccountForm(forms.Form):
|
||||
""" Basic Reddit account input form """
|
||||
|
||||
user = forms.ModelChoiceField(queryset=User.objects.order_by('username'))
|
||||
username = forms.CharField(label = u'Reddit Username', max_length=64)
|
||||
|
||||
def clean(self):
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
|
||||
from django.conf.urls.defaults import *
|
||||
|
||||
from sso import views
|
||||
from reddit import views
|
||||
|
||||
urlpatterns = patterns('',
|
||||
(r'^profile/add/reddit', views.reddit_add),
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.shortcuts import render_to_response, redirect
|
||||
from django.template import RequestContext
|
||||
from django.contrib import messages
|
||||
|
||||
from reddit.forms import RedditAccountForm
|
||||
from reddit.models import RedditAccount
|
||||
|
||||
@@ -15,7 +20,7 @@ def reddit_add(request):
|
||||
acc.api_update()
|
||||
except RedditAccount.DoesNotExist:
|
||||
messages.add_message(request, messages.ERROR, "Error, user %s does not exist on Reddit" % acc.username )
|
||||
return render_to_response('sso/redditaccount.html', locals(), context_instance=RequestContext(request))
|
||||
return render_to_response('reddit/add_reddit_account.html', locals(), context_instance=RequestContext(request))
|
||||
acc.save()
|
||||
|
||||
messages.add_message(request, messages.INFO, "Reddit account %s successfully added." % acc.username)
|
||||
|
||||
Reference in New Issue
Block a user