From 9d3dd664e1ca6b606ea8399674e9fe2b19f69fd0 Mon Sep 17 00:00:00 2001 From: Sanj Date: Fri, 13 Jul 2012 16:14:18 +0530 Subject: [PATCH 1/2] profile form updates, requirements small changes --- itf/itfprofiles/views.py | 15 ++++++++++++++- itf/templates/formwidgets/select2_multiple.html | 2 +- itf/templates/test/person_form.html | 2 +- itf/urls.py | 2 +- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/itf/itfprofiles/views.py b/itf/itfprofiles/views.py index 4b2fecf..7b92957 100644 --- a/itf/itfprofiles/views.py +++ b/itf/itfprofiles/views.py @@ -4,6 +4,8 @@ from forms import * from django.shortcuts import render_to_response from ox.django.shortcuts import render_to_json_response from django.core.paginator import Paginator, InvalidPage, EmptyPage +from django.template import RequestContext +from django.http import HttpResponse def person_form(request): person = Person.objects.all()[0] @@ -15,7 +17,18 @@ def person_form(request): def personpopup(request): form = PersonForm() - return render_to_response("test/popup.html", {'form': form}) + if request.POST: + return HttpResponse("" % ("45", "sanjay bhangar",)) + form = PersonForm(request.POST, request.FILES) + if form.is_valid(): + instance = form.save() +# return HttpResponse("" % (str(instance.id), instance.get_title())) + else: + form = PersonForm() + context = RequestContext(request, { + 'form': form + }) + return render_to_response("test/popup.html", context) def autocomplete(request): q = request.GET.get('q', 'a') diff --git a/itf/templates/formwidgets/select2_multiple.html b/itf/templates/formwidgets/select2_multiple.html index f08a314..3924040 100644 --- a/itf/templates/formwidgets/select2_multiple.html +++ b/itf/templates/formwidgets/select2_multiple.html @@ -1,2 +1,2 @@ - Add + Add diff --git a/itf/templates/test/person_form.html b/itf/templates/test/person_form.html index 00e8d4f..36f7d64 100644 --- a/itf/templates/test/person_form.html +++ b/itf/templates/test/person_form.html @@ -8,7 +8,7 @@ - +