This commit is contained in:
Schuyler Erle 2011-08-31 03:22:52 -07:00
commit 6f36b791d7
4 changed files with 9 additions and 6 deletions

View File

@ -43,7 +43,7 @@ class FeatureTypeFilter(SimpleListFilter):
''' '''
class authRecordForm(forms.ModelForm): class authRecordForm(forms.ModelForm):
uri = forms.CharField(label="URI", required=True, widget=forms.TextInput(attrs={'size': '40'})) uri = forms.CharField(label="URI", required=True, widget=forms.TextInput(attrs={'size': '50'}))
class Meta: class Meta:
model = AuthorityRecord model = AuthorityRecord
@ -51,7 +51,7 @@ class authRecordForm(forms.ModelForm):
class featuresForm(forms.ModelForm): class featuresForm(forms.ModelForm):
url = forms.CharField(label='URI', url = forms.CharField(label='URI',
required=True, required=True,
widget=forms.TextInput(attrs={'size': '40'})) widget=forms.TextInput(attrs={'size': '50'}))
authority_record = AutoCompleteSelectField('authority_record', required=False) authority_record = AutoCompleteSelectField('authority_record', required=False)
time_frame = AutoCompleteSelectField('time_frame', required=False) time_frame = AutoCompleteSelectField('time_frame', required=False)
feature_type = AutoCompleteSelectField('feature_type', required=False) feature_type = AutoCompleteSelectField('feature_type', required=False)
@ -70,6 +70,7 @@ class relationsForm(forms.ModelForm):
class AuthorityRecordAdmin(admin.ModelAdmin): class AuthorityRecordAdmin(admin.ModelAdmin):
form = authRecordForm form = authRecordForm
list_display = ('__unicode__', 'uri',)
search_fields = ['preferred_name'] search_fields = ['preferred_name']
class RelationshipAdmin(admin.ModelAdmin): class RelationshipAdmin(admin.ModelAdmin):
@ -113,7 +114,7 @@ class TimeFrameAdmin(admin.ModelAdmin):
list_display = ('description', 'start_date', 'end_date', 'start_granularity', 'end_granularity',) list_display = ('description', 'start_date', 'end_date', 'start_granularity', 'end_granularity',)
admin.site.register(Feature, FeatureAdmin) admin.site.register(Feature, FeatureAdmin)
admin.site.register(TimeFrame) admin.site.register(TimeFrame, TimeFrameAdmin)
admin.site.register(FeatureType, FeatureTypeAdmin) admin.site.register(FeatureType, FeatureTypeAdmin)
admin.site.register(Relationship, RelationshipAdmin) admin.site.register(Relationship, RelationshipAdmin)
admin.site.register(AuthorityRecord, AuthorityRecordAdmin) admin.site.register(AuthorityRecord, AuthorityRecordAdmin)

View File

@ -28,7 +28,7 @@ def search_json(request):
bbox = map(float, bbox.split(",")) bbox = map(float, bbox.split(","))
except ValueError: except ValueError:
bbox = None bbox = None
return render_to_json_response({'error': 'bbox must be in the form: minx,miny,maxx,maxy'}) return render_to_json_response({'error': 'bbox must be in the form: minx,miny,maxx,maxy'})
if not bbox and not search_term: if not bbox and not search_term:
return render_to_json_response({'error': 'must supply either a valid `bbox` or a `search` parameter'}) return render_to_json_response({'error': 'must supply either a valid `bbox` or a `search` parameter'})

View File

@ -39,8 +39,8 @@ $(function() {
function getRow(props) { function getRow(props) {
var $tr = $('<tr />'); var $tr = $('<tr />');
var $one = $('<td />').appendTo($tr); var $one = $('<td />').appendTo($tr);
var $a = $('<a />').attr("target", "_blank").attr("href", "/admin/places/feature/" + props.id).text(props.preferred_name + " ").appendTo($one); var $a = $('<a />').attr("target", "_blank").attr("href", "/admin/places/feature/" + props.id).text(props.preferred_name).appendTo($one);
var $a2 = $('<a />').addClass("viewSimilar").attr("target", "_blank").attr("href", "/search_related?id=" + props.id).text("view similar").appendTo($one); // var $a2 = $('<a />').addClass("viewSimilar").attr("target", "_blank").attr("href", "/search_related?id=" + props.id).text("view similar").appendTo($one);
$('<td />').text(props.feature_type).appendTo($tr); $('<td />').text(props.feature_type).appendTo($tr);
$('<td />').text(props.admin2).appendTo($tr); $('<td />').text(props.admin2).appendTo($tr);
$('<td />').text(props.admin1).appendTo($tr); $('<td />').text(props.admin1).appendTo($tr);

View File

@ -9,6 +9,7 @@ admin.autodiscover()
urlpatterns = patterns('', urlpatterns = patterns('',
# Example: # Example:
# (r'^gazetteer/', include('gazetteer.foo.urls')), # (r'^gazetteer/', include('gazetteer.foo.urls')),
(r'^$', 'places.views.search'),
('^search$', 'places.views.search'), ('^search$', 'places.views.search'),
('^feature/search.json$', 'places.views.search_json'), ('^feature/search.json$', 'places.views.search_json'),
('^search_related$', 'places.views.search_related'), ('^search_related$', 'places.views.search_related'),
@ -19,6 +20,7 @@ urlpatterns = patterns('',
(r'^ajax_select/', include('ajax_select.urls')), (r'^ajax_select/', include('ajax_select.urls')),
# Uncomment the next line to enable the admin: # Uncomment the next line to enable the admin:
(r'^admin/', include(admin.site.urls)), (r'^admin/', include(admin.site.urls)),
) )
if settings.LOCAL_DEVELOPMENT: if settings.LOCAL_DEVELOPMENT: