From 2022b772a01f36fa74de002b5370dd70b6c051ba Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Wed, 19 Aug 2009 21:29:51 -0400 Subject: added Adolfos mods, django_authopeid bug, unified traditional and OpenID login --- django_authopenid/urls.py | 12 +- django_authopenid/views.py | 23 +- forum/managers.py | 2 +- forum/views.py | 8 +- locale/en/LC_MESSAGES/django.mo | Bin 14334 -> 15146 bytes locale/en/LC_MESSAGES/django.po | 229 ++++++++------ locale/es/LC_MESSAGES/django.mo | Bin 49490 -> 49819 bytes locale/es/LC_MESSAGES/django.po | 346 +++++++++++---------- templates/authopenid/sendpw.html | 2 +- templates/authopenid/settings.html | 2 +- templates/authopenid/signin.html | 79 ++--- .../content/jquery-openid/images/local-login.png | Bin 0 -> 2522 bytes .../content/jquery-openid/images/openidico16.png | Bin 0 -> 554 bytes templates/content/jquery-openid/jquery.openid.js | 19 ++ templates/content/jquery-openid/openid.css | 16 + templates/content/style/style.css | 4 +- templates/footer.html | 2 +- templates/question.html | 4 +- 18 files changed, 427 insertions(+), 321 deletions(-) create mode 100644 templates/content/jquery-openid/images/local-login.png create mode 100644 templates/content/jquery-openid/images/openidico16.png diff --git a/django_authopenid/urls.py b/django_authopenid/urls.py index 9c0887d8..f5d7a72f 100644 --- a/django_authopenid/urls.py +++ b/django_authopenid/urls.py @@ -12,17 +12,15 @@ urlpatterns = patterns('django_authopenid.views', url(r'^%s$' % _('signout/'), 'signout', name='user_signout'), url(r'^%s%s$' % (_('signin/'), _('complete/')), 'complete_signin', name='user_complete_signin'), - url(r'^%s$' % _('register/'), 'register', name='user_register'), + #url(r'^%s$' % _('register/'), 'register', name='user_register'), url(r'^%s$' % _('signup/'), 'signup', name='user_signup'), #disable current sendpw function - url(r'^%s$' % _('sendpw/'), 'signin', name='user_sendpw'), - #url(r'^%s$' % _('sendpw/'), 'sendpw', name='user_sendpw'), - #url(r'^%s%s$' % (_('password/'), _('confirm/')), 'confirmchangepw', - # name='user_confirmchangepw'), + url(r'^%s$' % _('sendpw/'), 'sendpw', name='user_sendpw'), + url(r'^%s%s$' % (_('password/'), _('confirm/')), 'confirmchangepw', name='user_confirmchangepw'), # manage account settings - #url(r'^$', _('account_settings'), name='user_account_settings'), - #url(r'^%s$' % _('password/'), 'changepw', name='user_changepw'), + url(r'^$', _('account_settings'), name='user_account_settings'), + url(r'^%s$' % _('password/'), 'changepw', name='user_changepw'), url(r'^%s$' % _('email/'), 'changeemail', name='user_changeemail',kwargs = {'action':'change'}), url(r'^%s%s$' % (_('email/'),_('validate/')), 'changeemail', name='user_changeemail',kwargs = {'action':'validate'}), #url(r'^%s$' % _('openid/'), 'changeopenid', name='user_changeopenid'), diff --git a/django_authopenid/views.py b/django_authopenid/views.py index 218a31a2..65d579f4 100644 --- a/django_authopenid/views.py +++ b/django_authopenid/views.py @@ -175,9 +175,18 @@ def signin(request,newquestion=False,newanswer=False): form_auth = OpenidAuthForm(initial={'next':next}) if request.POST: - - if 'bsignin' in request.POST.keys() or 'openid_username' in request.POST.keys(): + if 'blogin' in request.POST.keys(): + # perform normal django authentification + form_auth = OpenidAuthForm(request.POST) + if form_auth.is_valid(): + user_ = form_auth.get_user() + login(request, user_) + next = clean_next(form_auth.cleaned_data.get('next')) + print 'next stop is "%s"' % next + return HttpResponseRedirect(next) + + elif 'bsignin' in request.POST.keys() or 'openid_username' in request.POST.keys(): form_signin = OpenidSigninForm(request.POST) if form_signin.is_valid(): next = clean_next(form_signin.cleaned_data.get('next')) @@ -193,14 +202,6 @@ def signin(request,newquestion=False,newanswer=False): on_failure=signin_failure, sreg_request=sreg_req) - elif 'blogin' in request.POST.keys(): - # perform normal django authentification - form_auth = OpenidAuthForm(request.POST) - if form_auth.is_valid(): - user_ = form_auth.get_user() - login(request, user_) - next = clean_next(form_auth.cleaned_data.get('next')) - return HttpResponseRedirect(next) question = None if newquestion == True: @@ -368,7 +369,7 @@ def register(request): return render('authopenid/complete.html', { 'form1': form1, 'form2': form2, - 'provider':providers[provider_name], + 'provider':provider_logo, 'nickname': nickname, 'email': email }, context_instance=RequestContext(request)) diff --git a/forum/managers.py b/forum/managers.py index 2e3e4186..6ae0ed99 100644 --- a/forum/managers.py +++ b/forum/managers.py @@ -20,7 +20,7 @@ class QuestionManager(models.Manager): return questions def get_unanswered_questions(self, orderby): - questions = self.filter(deleted=False, answer_count=0).order_by(orderby) + questions = self.filter(deleted=False, answer_accepted=False).order_by(orderby) return questions def get_questions(self, orderby): diff --git a/forum/views.py b/forum/views.py index ce722118..d663a4cb 100644 --- a/forum/views.py +++ b/forum/views.py @@ -1149,12 +1149,8 @@ def user_stats(request, user_id, user_view): params=[user.id] ).values('id', 'name', 'description', 'type') total_awards = awards.count() - #fixed to work with Django version < 1.1 - try: - from django.db.models import Count - awards = awards.annotate(count = Count('badge__id')) - except: - pass + from django.db.models import Count + awards = awards.annotate(count = Count('badge__id')) return render_to_response(user_view.template_file,{ "tab_name" : user_view.id, diff --git a/locale/en/LC_MESSAGES/django.mo b/locale/en/LC_MESSAGES/django.mo index 447afac4..cd8de560 100644 Binary files a/locale/en/LC_MESSAGES/django.mo and b/locale/en/LC_MESSAGES/django.mo differ diff --git a/locale/en/LC_MESSAGES/django.po b/locale/en/LC_MESSAGES/django.po index ff280947..b5e5c549 100644 --- a/locale/en/LC_MESSAGES/django.po +++ b/locale/en/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-08-12 15:41+0000\n" +"POT-Creation-Date: 2009-08-19 00:41+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,13 +16,13 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: settings.py:12 urls.py:25 forum/views.py:304 forum/views.py:698 +#: settings.py:12 urls.py:25 forum/views.py:305 forum/views.py:699 msgid "account/" msgstr "" #: settings.py:12 urls.py:26 django_authopenid/urls.py:9 #: django_authopenid/urls.py:10 django_authopenid/urls.py:11 -#: django_authopenid/urls.py:13 forum/views.py:304 forum/views.py:699 +#: django_authopenid/urls.py:13 forum/views.py:305 forum/views.py:700 #: templates/authopenid/confirm_email.txt:10 msgid "signin/" msgstr "" @@ -82,7 +82,8 @@ msgstr "" #: urls.py:37 urls.py:38 urls.py:39 urls.py:40 urls.py:41 urls.py:42 #: urls.py:43 urls.py:44 urls.py:45 urls.py:46 urls.py:47 forum/feed.py:19 -#: forum/models.py:306 forum/views.py:1416 +#: forum/models.py:306 forum/views.py:1188 forum/views.py:1190 +#: forum/views.py:1430 msgid "questions/" msgstr "" @@ -118,12 +119,12 @@ msgstr "" msgid "question/" msgstr "" -#: urls.py:51 urls.py:52 forum/views.py:740 forum/views.py:2013 +#: urls.py:51 urls.py:52 forum/views.py:741 forum/views.py:2027 msgid "tags/" msgstr "" -#: urls.py:53 urls.py:54 urls.py:55 forum/views.py:993 forum/views.py:997 -#: forum/views.py:1418 forum/views.py:1751 forum/views.py:2015 +#: urls.py:53 urls.py:54 urls.py:55 forum/views.py:994 forum/views.py:998 +#: forum/views.py:1432 forum/views.py:1765 forum/views.py:2029 msgid "users/" msgstr "" @@ -238,7 +239,7 @@ msgstr "" msgid "Incorrect username." msgstr "" -#: django_authopenid/urls.py:10 forum/views.py:304 forum/views.py:699 +#: django_authopenid/urls.py:10 forum/views.py:305 forum/views.py:700 msgid "newquestion/" msgstr "" @@ -695,27 +696,27 @@ msgstr "" msgid "profile - user preferences" msgstr "" -#: forum/views.py:947 +#: forum/views.py:948 #, python-format msgid "subscription saved, %(email)s needs validation" msgstr "" "Your subscription is saved, but email address %(email)s needs to be " "validated, please see more details here" -#: forum/views.py:1860 +#: forum/views.py:1874 msgid "uploading images is limited to users with >60 reputation points" msgstr "" -#: forum/views.py:1862 +#: forum/views.py:1876 msgid "allowed file types are 'jpg', 'jpeg', 'gif', 'bmp', 'png', 'tiff'" msgstr "" -#: forum/views.py:1864 +#: forum/views.py:1878 #, python-format msgid "maximum upload file size is %sK" msgstr "" -#: forum/views.py:1866 +#: forum/views.py:1880 #, python-format msgid "" "Error uploading file. Please contact the site administrator. Thank you. %s" @@ -723,7 +724,7 @@ msgstr "" #: forum/management/commands/send_email_alerts.py:35 msgid "updates from website" -msgstr "" +msgstr "Q&A forum update" #: forum/templatetags/extra_tags.py:143 forum/templatetags/extra_tags.py:172 #: templates/header.html:35 @@ -937,7 +938,7 @@ msgid "must have valid %(email)s to post" msgstr "" "Looks like your email address, %(email)s has not " "yet been validated. To post messages you must verify your email, " -"please see more details here.
You can submit " +"please see more details here.
You can submit " "your question now and validate email after that. Your question will saved as " "pending meanwhile. " @@ -965,7 +966,7 @@ msgstr "" msgid "Badges summary" msgstr "" -#: templates/badges.html:17 templates/user_stats.html:115 +#: templates/badges.html:17 templates/user_stats.html:73 msgid "Badges" msgstr "" @@ -1070,17 +1071,17 @@ msgid "ask the author" msgstr "" #: templates/book.html:88 templates/book.html.py:93 -#: templates/users_questions.html:17 +#: templates/users_questions.html:18 msgid "this question was selected as favorite" msgstr "" #: templates/book.html:88 templates/book.html.py:93 -#: templates/users_questions.html:11 templates/users_questions.html.py:17 +#: templates/users_questions.html:11 templates/users_questions.html.py:18 msgid "number of times" msgstr "" #: templates/book.html:105 templates/index.html:48 templates/questions.html:46 -#: templates/unanswered.html:37 templates/users_questions.html:30 +#: templates/unanswered.html:37 templates/users_questions.html:32 msgid "votes" msgstr "" @@ -1089,14 +1090,14 @@ msgid "the answer has been accepted to be correct" msgstr "" #: templates/book.html:115 templates/index.html:49 templates/questions.html:47 -#: templates/unanswered.html:38 templates/users_questions.html:40 +#: templates/unanswered.html:38 templates/users_questions.html:42 msgid "views" msgstr "" #: templates/book.html:125 templates/index.html:69 templates/question.html:499 #: templates/questions.html:84 templates/questions.html.py:156 #: templates/tags.html:49 templates/unanswered.html:75 -#: templates/unanswered.html.py:106 templates/users_questions.html:52 +#: templates/unanswered.html.py:106 templates/users_questions.html:54 msgid "using tags" msgstr "" @@ -1265,13 +1266,13 @@ msgid "how to validate email info" msgstr "" "

How? If you have just set or changed your email " -"address - check your email and click the included link.
The link contains a key generated specifically for you. You can also " +"address - check your email and click the included link." +"
The link contains a key generated specifically for you. You can also " "