forget about formsets and make things work again

This commit is contained in:
Sanj 2011-09-01 07:21:46 +05:30
parent df8415e718
commit 7301d5157a
3 changed files with 11 additions and 3 deletions

View File

@ -1,6 +1,6 @@
from django.contrib.gis import admin
from models import *
from forms import BaseRelationsFormSet
# from forms import BaseRelationsFormSet
from django import forms
#from django.contrib.admin import SimpleListFilter
from ajax_select.fields import AutoCompleteSelectMultipleField, AutoCompleteSelectField
@ -82,19 +82,20 @@ class FeatureNamesInline(admin.TabularInline):
model = Name
extra = 0
'''
class FeatureRelationInline(admin.TabularInline):
model = Feature.relationships.through
extra = 1
fk_name = 'feature1'
formset = BaseRelationsFormSet
'''
class FeatureAdmin(admin.OSMGeoAdmin):
fields = ('preferred_name', 'feature_type', 'admin1', 'admin2', 'geometry', 'url', 'authority_record', 'time_frame', 'is_primary',)
search_fields = ['preferred_name']
# list_filter = ('feature_type',)
inlines = [FeatureNamesInline, FeatureRelationInline]
inlines = [FeatureNamesInline]
list_display = ('__unicode__', 'feature_type_name', 'admin1', 'admin2', 'time_start', 'time_end',)
list_per_page = 30
# list_filter = (FeatureTypeFilter,)

View File

@ -93,6 +93,7 @@ def search_related_json(request, id):
else:
time_frame = ''
d.append({
'id': s.id,
'feature_type': FeatureType.objects.get(pk=s.feature_type_id).name,
@ -124,3 +125,7 @@ def time_frame_json(request):
}
return render_to_json_response(d)

View File

@ -34,3 +34,5 @@ function getRow(d) {
return $tr;
}