]> git.openstreetmap.org Git - osqa.git/commitdiff
Closing OSQA 102, the ip address on the feedback email is empty.
authorhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Thu, 13 May 2010 10:26:31 +0000 (10:26 +0000)
committerhernani <hernani@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Thu, 13 May 2010 10:26:31 +0000 (10:26 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@253 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/skins/default/templates/notifications/feedback.html
forum/views/meta.py
forum/views/writers.py

index 06b8b8411385d22263afbe2069be94f756ef6ebd..575afd5812f7910b8845009852995fafcb3d82e7 100644 (file)
@@ -18,7 +18,7 @@
             {% if email %}{% trans "email" %}:{{ email }}{% endif %}
         {% endif %}
         <br/>
-            ip: {{request.META.REMOTE_ADDR}}
+            ip: {{ ip }}
     </p>
 
     <blockquote>
index c143d133e5039dc0543e350ea155d12a4cc4b3d4..ac979381e9b4edfa0e95c9ae315da22d556a2236 100644 (file)
@@ -38,6 +38,7 @@ def feedback(request):
                 context['email'] = form.cleaned_data.get('email',None)
             context['message'] = form.cleaned_data['message']
             context['name'] = form.cleaned_data.get('name',None)
+            context['ip'] = request.META['REMOTE_ADDR']
 
             recipients = [(adm.username, adm.email) for adm in User.objects.filter(is_superuser=True)]
 
index 638f070945ea42ffc169ccdf78b2c6eb4b0419af..3b3e90b5c951792f414a62529d63afee56ceeb6f 100644 (file)
@@ -70,7 +70,7 @@ def ask(request):
         form = AskForm(request.POST)
         if form.is_valid():
             if request.user.is_authenticated():
-                question = AskAction(user=request.user).save(data=form.cleaned_data).node
+                question = AskAction(user=request.user, ip=request.META['REMOTE_ADDR']).save(data=form.cleaned_data).node
                 return HttpResponseRedirect(question.get_absolute_url())
             else:
                 request.session['temp_node_data'] = request.POST
@@ -105,7 +105,7 @@ def _retag_question(request, question):
         form = RetagQuestionForm(question, request.POST)
         if form.is_valid():
             if form.has_changed():
-                RetagAction(user=request.user, node=question).save(data=dict(tagnames=form.cleaned_data['tags']))
+                RetagAction(user=request.user, node=question, ip=request.META['REMOTE_ADDR']).save(data=dict(tagnames=form.cleaned_data['tags']))
 
             return HttpResponseRedirect(question.get_absolute_url())
     else:
@@ -129,7 +129,7 @@ def _edit_question(request, question):
 
         if not 'select_revision' in request.POST and form.is_valid():
             if form.has_changed():
-                ReviseAction(user=request.user, node=question).save(data=form.cleaned_data)
+                ReviseAction(user=request.user, node=question, ip=request.META['REMOTE_ADDR']).save(data=form.cleaned_data)
             else:
                 if not revision == question.active_revision:
                     RollbackAction(user=request.user, node=question).save(data=dict(activate=revision))
@@ -166,10 +166,10 @@ def edit_answer(request, id):
 
         if not 'select_revision' in request.POST and form.is_valid():
             if form.has_changed():
-                ReviseAction(user=request.user, node=answer).save(data=form.cleaned_data)
+                ReviseAction(user=request.user, node=answer, ip=request.META['REMOTE_ADDR']).save(data=form.cleaned_data)
             else:
                 if not revision == answer.active_revision:
-                    RollbackAction(user=request.user, node=answer).save(data=dict(activate=revision))
+                    RollbackAction(user=request.user, node=answer, ip=request.META['REMOTE_ADDR']).save(data=dict(activate=revision))
 
             return HttpResponseRedirect(answer.get_absolute_url())
 
@@ -189,7 +189,7 @@ def answer(request, id):
         form = AnswerForm(question, request.POST)
         if form.is_valid():
             if request.user.is_authenticated():
-                answer = AnswerAction(user=request.user).save(dict(question=question, **form.cleaned_data)).node
+                answer = AnswerAction(user=request.user, ip=request.META['REMOTE_ADDR']).save(dict(question=question, **form.cleaned_data)).node
                 return HttpResponseRedirect(answer.get_absolute_url())
             else:
                 request.session['temp_node_data'] = request.POST