merged sanjs branch 564, 563

This commit is contained in:
Johnson Chetty 2012-07-14 05:13:47 +02:00
commit 53ae6a500f
5 changed files with 21 additions and 8 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

@ -43,7 +43,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')),

View File

@ -1,9 +1,9 @@
-e svn+http://code.djangoproject.com/svn/django/branches/releases/1.3.X/#egg=django
-e bzr+http://code.0x2620.org/python-ox/#egg=python-ox
#-e svn+http://django-multilingual.googlecode.com/svn/trunk/#egg=multilingual
Django==1.3
ox
-e bzr+http://firefogg.org/dev/python-firefogg/#egg=python-firefogg
-e bzr+http://firefogg.org/dev/django_firefogg/#egg=django_firefogg
-e hg+https://django-ajax-filtered-fields.googlecode.com/hg/#egg=django-ajax-filtered-fields
#-e hg+https://django-ajax-filtered-fields.googlecode.com/hg/#egg=django-ajax-filtered-fields
-e git://github.com/bit/django-extensions.git#egg=django_extensions
sorl-thumbnail
django-tagging