On Feb 21, 4:22 am, Andre Terra <andrete...@gmail.com> wrote: > I'd also like some input on this, as I'm reaching a point of my project > where I'll have to deal with a similar issue. I was planning on using ajax, > which actually means keeping it simple IMHO, but I would really like to > follow best practice. > > Should I make one query with a large subset of the data once and then just > filter it with jQuery? This seems to be the lighter approach in terms of DB > hits, but I'm not sure it's the right solution, specially considering I want > to be able to export the filtered data to a csv/xls format. > > Any ideas would be greatly appreciated, I'm really in the dark on this. > > Sincerely, > André Terra > > On Tue, Feb 8, 2011 at 9:15 PM, SimpleDimple <farhandevelo...@gmail.com>wrote: > > > > > > > > > can anyone help or point me to some simple django based app that I can > > study to understand more ? > > > On Feb 8, 2:07 am, SimpleDimple <farhandevelo...@gmail.com> wrote: > > > I can live w/o AJAX for now to keep it simple. > > > > What I am not clear is on how to do the postback from javascript ? I > > > mean on what URL and pass on which variables ? and thru GET or POST or > > > shall i do form.submit() ?? > > > > On Feb 8, 1:45 am, Joel Goldstick <joel.goldst...@gmail.com> wrote: > > > > > On Mon, Feb 7, 2011 at 3:38 PM, SimpleDimple < > > farhandevelo...@gmail.com>wrote: > > > > > > I am new to django and building a school system but am experience > > > > > developer otherwise having firm grip over rails, php, .net and java. > > > > > > I have student table and in list I can see list of all students/ > > > > > records in student table....(pasted below is my code) > > > > > > what I want here is a custom dropdown listing the classes in school > > > > > from class table, and when you select/change the class the list of > > > > > students should get filtered accordingly....can someone please give > > me > > > > > hints or guide me a bit ? > > > > > > class StudentAdmin(admin.ModelAdmin): > > > > > fields = ['xclass', 'name', 'reg_no' , 'roll_no' ] > > > > > list_display = ['xclass', 'name', 'reg_no' , 'roll_no' ] > > > > > list_filter = ['name', 'reg_no' , 'roll_no' ] > > > > > search_fields = ['name', 'reg_no' , 'roll_no' ] > > > > > > form = StudentForm > > > > > > def queryset(self, request): > > > > > school_id = request.session['school_id'] > > > > > qs = self.model._default_manager.filter(school=school_id) > > > > > return qs > > > > > > def save_model(self, request, obj, form, change): > > > > > school_id = request.session['school_id'] > > > > > school = School.objects.get(id=school_id) > > > > > obj.school = school > > > > > obj.save() > > > > > > -- > > > > > You received this message because you are subscribed to the Google > > Groups > > > > > "Django users" group. > > > > > To post to this group, send email to django-users@googlegroups.com. > > > > > To unsubscribe from this group, send email to > > > > > django-users+unsubscr...@googlegroups.com. > > > > > For more options, visit this group at > > > > >http://groups.google.com/group/django-users?hl=en. > > > > > This topic has come up recently under different specifics. When you > > change > > > > your filter (by selecting a specific class) you need to requery with > > that > > > > condition. This can be done by submitting the form to get a new > > dataset, or > > > > by using AJAX style to have the data retrieved on the fly to repopulate > > your > > > > form. > > > > > -- > > > > Joel Goldstick
There is a very detailed set of code examples here: http://stackoverflow.com/questions/1671446/country-state-city-dropdown-menus-inside-the-django-admin-inline -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.