try basic autocomplete for authority records
This commit is contained in:
parent
052561ebc5
commit
ccd8f454f8
|
@ -58,6 +58,8 @@ class featuresForm(forms.ModelForm):
|
|||
url = forms.CharField(label='URI',
|
||||
required=True,
|
||||
widget=forms.TextInput(attrs={'size': '40'}))
|
||||
authority_record = AutoCompleteSelectField('authority_record', required=False)
|
||||
|
||||
# exclude = ('info',)
|
||||
|
||||
class Meta:
|
||||
|
|
|
@ -84,6 +84,17 @@ MIDDLEWARE_CLASSES = (
|
|||
'debug_toolbar.middleware.DebugToolbarMiddleware',
|
||||
)
|
||||
|
||||
AJAX_LOOKUP_CHANNELS = {
|
||||
# the simplest case, pass a DICT with the model and field to search against :
|
||||
'authority_record' : dict(model='places.authorityrecord',search_field='preferred_name'),
|
||||
# this generates a simple channel
|
||||
# specifying the model Track in the music app, and searching against the 'title' field
|
||||
|
||||
# or write a custom search channel and specify that using a TUPLE
|
||||
# 'contact' : ('peoplez.lookups', 'ContactLookup'),
|
||||
# this specifies to look for the class `ContactLookup` in the `peoplez.lookups` module
|
||||
}
|
||||
|
||||
ROOT_URLCONF = 'gazetteer.urls'
|
||||
|
||||
TEMPLATE_DIRS = (
|
||||
|
|
48
gazetteer/static/css/jquery.autocomplete.css
Normal file
48
gazetteer/static/css/jquery.autocomplete.css
Normal file
|
@ -0,0 +1,48 @@
|
|||
.ac_results {
|
||||
padding: 0px;
|
||||
border: 1px solid black;
|
||||
background-color: white;
|
||||
overflow: hidden;
|
||||
z-index: 99999;
|
||||
}
|
||||
|
||||
.ac_results ul {
|
||||
width: 100%;
|
||||
list-style-position: outside;
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.ac_results li {
|
||||
margin: 0px;
|
||||
padding: 2px 5px;
|
||||
cursor: default;
|
||||
display: block;
|
||||
/*
|
||||
if width will be 100% horizontal scrollbar will apear
|
||||
when scroll mode will be used
|
||||
*/
|
||||
/*width: 100%;*/
|
||||
font: menu;
|
||||
font-size: 12px;
|
||||
/*
|
||||
it is very important, if line-height not setted or setted
|
||||
in relative units scroll will be broken in firefox
|
||||
*/
|
||||
line-height: 16px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.ac_loading {
|
||||
background: white url('indicator.gif') right center no-repeat;
|
||||
}
|
||||
|
||||
.ac_odd {
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
.ac_over {
|
||||
background-color: #0A246A;
|
||||
color: white;
|
||||
}
|
15
gazetteer/static/js/jquery.autocomplete.min.js
vendored
Normal file
15
gazetteer/static/js/jquery.autocomplete.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -2,8 +2,12 @@
|
|||
|
||||
{% block extrahead %}
|
||||
{{ block.super }}
|
||||
<script type="text/javascript" src="/static/js/jquery.js"></script>
|
||||
<script type="text/javascript" src="/static/js/jquery.autocomplete.min.js"></script>
|
||||
<!-- jquery autocomplete from: https://github.com/agarzola/jQueryAutocompletePlugin -->
|
||||
<script type="text/javascript" src="/static/js/feature_admin.js"></script>
|
||||
<link rel="stylesheet" href="/static/css/feature_admin.css" />
|
||||
<link rel="stylesheet" href="/static/css/jquery.autocomplete.css" />
|
||||
{% endblock %}
|
||||
|
||||
{% block after_related_objects %}
|
||||
|
|
|
@ -15,7 +15,7 @@ urlpatterns = patterns('',
|
|||
('^search_related_json$', 'places.views.search_related_json'),
|
||||
# Uncomment the admin/doc line below to enable admin documentation:
|
||||
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
|
||||
|
||||
(r'^ajax_select/', include('ajax_select.urls')),
|
||||
# Uncomment the next line to enable the admin:
|
||||
(r'^admin/', include(admin.site.urls)),
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue
Block a user