testing popups
This commit is contained in:
parent
f44cd331a3
commit
93bab11ff7
|
@ -28,7 +28,7 @@ class ConnectionsWidget(forms.SelectMultiple):
|
||||||
|
|
||||||
def get_context(self, name, value, attrs, *args, **kwargs):
|
def get_context(self, name, value, attrs, *args, **kwargs):
|
||||||
ctx = super(ConnectionsWidget, self).get_context(name, value, attrs)
|
ctx = super(ConnectionsWidget, self).get_context(name, value, attrs)
|
||||||
|
ctx['popup_url'] = '/m/person/popup' #FIXME: url scheme, also, a better way to pass this context to the widget template.
|
||||||
#selected_values = [{'id': obj[0], 'text': obj[1]} for obj in self.choices if obj[0] in value]
|
#selected_values = [{'id': obj[0], 'text': obj[1]} for obj in self.choices if obj[0] in value]
|
||||||
#ctx['data_json'] = json.dumps(selected_values) # json.dumps(choices)
|
#ctx['data_json'] = json.dumps(selected_values) # json.dumps(choices)
|
||||||
return ctx
|
return ctx
|
||||||
|
|
|
@ -13,6 +13,9 @@ def person_form(request):
|
||||||
#pdb.set_trace()
|
#pdb.set_trace()
|
||||||
return render_to_response("test/person_form.html", {'form': form, 'inlines': inlines})
|
return render_to_response("test/person_form.html", {'form': form, 'inlines': inlines})
|
||||||
|
|
||||||
|
def personpopup(request):
|
||||||
|
form = PersonForm()
|
||||||
|
return render_to_response("test/popup.html", {'form': form})
|
||||||
|
|
||||||
def autocomplete(request):
|
def autocomplete(request):
|
||||||
q = request.GET.get('q', 'a')
|
q = request.GET.get('q', 'a')
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
<input type="hidden" id="id_{{name}}" name="{{name}}" class="select2class" value="{% for v in value %}{{ v }},{% endfor %}" style="width:600px;" />
|
<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>
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
<link rel="stylesheet" href="/static/uni_form/uni-form.css" type="text/css" />
|
<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/uni_form/default.uni-form.css" type="text/css" />
|
||||||
<link rel="stylesheet" href="/static/css/select2/select2.css" />
|
<link rel="stylesheet" href="/static/css/select2/select2.css" />
|
||||||
|
<script type="text/javascript" src="/admin/media/RelatedObjectLookups.js"></script>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.select2-search-choice {
|
.select2-search-choice {
|
||||||
float: none !important;
|
float: none !important;
|
||||||
|
|
|
@ -38,9 +38,10 @@ urlpatterns = patterns('',
|
||||||
# ('^getLanguages', 'itfcore.views.getLanguages'),
|
# ('^getLanguages', 'itfcore.views.getLanguages'),
|
||||||
# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
|
# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
|
||||||
# to INSTALLED_APPS to enable admin documentation:
|
# to INSTALLED_APPS to enable admin documentation:
|
||||||
#Core views:
|
#Test views:
|
||||||
(r'test_profile', 'itfprofiles.views.person_form'),
|
(r'test_profile', 'itfprofiles.views.person_form'),
|
||||||
(r'^autocompletes/itfprofiles/$', 'itfprofiles.views.autocomplete'),
|
(r'^autocompletes/itfprofiles/$', 'itfprofiles.views.autocomplete'),
|
||||||
|
(r'^m/person/popup', 'itfprofiles.views.personpopup'),
|
||||||
# (r'i/', include('itfcore.urls')),
|
# (r'i/', include('itfcore.urls')),
|
||||||
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
|
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
|
||||||
(r'^search/', include('haystack.urls')),
|
(r'^search/', include('haystack.urls')),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user