diff options
Diffstat (limited to 'askbot/views/meta.py')
-rw-r--r-- | askbot/views/meta.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/askbot/views/meta.py b/askbot/views/meta.py index e4209185..7b271219 100644 --- a/askbot/views/meta.py +++ b/askbot/views/meta.py @@ -16,6 +16,8 @@ from django.db.models import Max, Count from askbot import skins from askbot.conf import settings as askbot_settings from askbot.forms import FeedbackForm +from askbot.utils.url_utils import get_login_url +from askbot.utils.forms import get_next_url from askbot.mail import mail_moderators from askbot.models import BadgeData, Award, User, Tag from askbot.models import badges as badge_data @@ -84,9 +86,19 @@ def faq(request): def feedback(request): data = {'page_class': 'meta'} form = None + + if askbot_settings.ALLOW_ANONYMOUS_FEEDBACK is False: + if request.user.is_anonymous(): + message = _('Please sign in or register to send your feedback') + request.user.message_set.create(message=message) + redirect_url = get_login_url() + '?next=' + request.path + return HttpResponseRedirect(redirect_url) + if request.method == "POST": - form = FeedbackForm(is_auth = request.user.is_authenticated(), - data = request.POST) + form = FeedbackForm( + is_auth=request.user.is_authenticated(), + data=request.POST + ) if form.is_valid(): if not request.user.is_authenticated(): data['email'] = form.cleaned_data.get('email',None) |