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.

Reply via email to