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

View File

@ -92,6 +92,7 @@ def search_related_json(request, id):
time_frame = f.time_frame.description time_frame = f.time_frame.description
else: else:
time_frame = '' time_frame = ''
d.append({ d.append({
'id': s.id, 'id': s.id,
@ -124,3 +125,7 @@ def time_frame_json(request):
} }
return render_to_json_response(d) return render_to_json_response(d)

View File

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