project/kiwipycon/user/views.py
changeset 101 fb27be005a5c
parent 96 3ece0de11641
--- a/project/kiwipycon/user/views.py	Tue May 11 03:51:25 2010 +0530
+++ b/project/kiwipycon/user/views.py	Tue Jul 13 01:01:02 2010 +0530
@@ -1,23 +1,22 @@
 # -*- coding: utf-8 -*-
 from __future__ import absolute_import
-
 #python
 from urlparse import urlparse
+import urllib
 import os
 
 #django
 from django.conf import settings
+from django.shortcuts import render_to_response
+from django.template import RequestContext
+from django.core.urlresolvers import reverse
+from django.db.models.signals import post_save
+
+#django.contrib
 from django.contrib.auth.decorators import login_required
 from django.contrib.auth.forms import AuthenticationForm
 from django.contrib.auth.forms import PasswordChangeForm
-from django.contrib.auth.models import User
 from django.core.exceptions import ObjectDoesNotExist
-from django.core.urlresolvers import reverse
-from django.db.models import Q
-from django.http import HttpResponse
-from django.shortcuts import render_to_response
-from django.template import RequestContext
-from django.utils import simplejson as json
 
 #PIL
 from PIL import Image
@@ -28,6 +27,7 @@
 from project.kiwipycon.registration.models import Registration
 from project.kiwipycon.registration.models import Wifi
 from project.kiwipycon.registration.forms import WifiForm
+from project.kiwipycon.sponsor.models import Sponsor
 
 from .utils import kiwipycon_createuser
 from .utils import handle_uploaded_photo
@@ -57,6 +57,8 @@
     else:
         photo = '/img/user-default.png'
 
+    qstring = ""
+
     wifi_comment = None
     if wifiobj:
         wifi_form = False
@@ -234,32 +236,3 @@
         "form": username_form
     }))
 
-
-def get_usernames(request):
-    """Returns in json the list of ten possible usernames
-    starting with the last pattern in the comma separated string
-    """
-
-    get_params = request.GET
-    search_author = get_params.get('q')
-
-    if search_author:
-        search_author = search_author.strip()
-    else:
-        return HttpResponse(json.dumps(''))
-    
-
-    users = User.objects.filter(
-        Q(username__istartswith=search_author) | Q(
-        first_name__istartswith=search_author) | Q(
-        last_name__istartswith=search_author))
-
-    results = []
-    
-    for user in users:
-        results.append(
-            {'name': str(user.username),
-             'value': '%s (%s)' % (user.get_full_name(), user.username)
-            })
-
-    return HttpResponse(json.dumps(results))