profile form updates, requirements small changes

This commit is contained in:
Sanj 2012-07-13 16:14:18 +05:30
parent 93bab11ff7
commit 9d3dd664e1
4 changed files with 17 additions and 4 deletions

View File

@ -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("<script>opener.dismissAddAnotherPopup(window, '%s', '%s')</script>" % ("45", "sanjay bhangar",))
form = PersonForm(request.POST, request.FILES)
if form.is_valid():
instance = form.save()
# return HttpResponse("<script>opener.dismissAddAnotherPopup(this, '%s', '%s')</script>" % (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')

View File

@ -1,2 +1,2 @@
<input type="hidden" id="id_{{name}}" name="{{name}}" class="select2class" value="{% for v in value %}{{ v }},{% endfor %}" style="width:600px;" /> <a href="/popups/{{name}}" id="add_{{name}}" onclick="return showAddPopup(this);">Add</a>
<input type="hidden" id="id_{{name}}" name="{{name}}" class="select2class" value="{% for v in value %}{{ v }},{% endfor %}" style="width:600px;" /> <a href="/popup/person" id="add_{{name}}" onclick="return showAddAnotherPopup(this);">Add</a>

View File

@ -8,7 +8,7 @@
<link rel="stylesheet" href="/static/uni_form/uni-form.css" type="text/css" />
<link rel="stylesheet" href="/static/uni_form/default.uni-form.css" type="text/css" />
<link rel="stylesheet" href="/static/css/select2/select2.css" />
<script type="text/javascript" src="/admin/media/RelatedObjectLookups.js"></script>
<script type="text/javascript" src="/static/js/RelatedObjectLookups.js"></script>
<style type="text/css">
.select2-search-choice {
float: none !important;

View File

@ -41,7 +41,7 @@ urlpatterns = patterns('',
#Test views:
(r'test_profile', 'itfprofiles.views.person_form'),
(r'^autocompletes/itfprofiles/$', 'itfprofiles.views.autocomplete'),
(r'^m/person/popup', 'itfprofiles.views.personpopup'),
(r'^popup/person', 'itfprofiles.views.personpopup'),
# (r'i/', include('itfcore.urls')),
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
(r'^search/', include('haystack.urls')),