The following commit has been merged in the master branch:
commit fa0fc6d50a1040bd1164831d7a37884706666ceb
Author: Michal Čihař <[email protected]>
Date:   Wed Oct 7 17:40:29 2009 +0200

    Store IP address.

diff --git a/phonedb/views.py b/phonedb/views.py
index 9344a1c..ac7a23b 100644
--- a/phonedb/views.py
+++ b/phonedb/views.py
@@ -6,6 +6,7 @@ from django.core.paginator import Paginator, InvalidPage, 
EmptyPage
 from django.core.cache import cache
 from django.utils.translation import ugettext as _
 import csv
+import socket
 from django.http import HttpResponse, HttpResponseRedirect
 
 
@@ -252,6 +253,9 @@ def create(request):
         form = NewForm(request.POST)
         if form.is_valid():
             newphone = form.save()
+            newphone.address = request.META.get('REMOTE_ADDR')
+            newphone.hostname = socket.gethostbyaddr(newphone.address)[0]
+            newphone.save()
             result = HttpResponseRedirect(newphone.get_absolute_url())
             request.session['message'] = _('Phone record has been created.')
             result.set_cookie('phonedb_garble', 
form.cleaned_data['email_garble'], max_age = 3600 * 24 * 365)

-- 
UNNAMED PROJECT

_______________________________________________
Wammu-svn mailing list
[email protected]
https://lists.cihar.com/cgi-bin/mailman/listinfo/wammu-svn

Reply via email to