Good morning, I'm new to django, and in need for a little pointers:
I've a bunch of Choicefields that I want to update ( similar to Country-city-street, type of behavior ). How would I go about updating those fileds, without reloading the page? Javascript? Ajax? or django have a way to update only given form/ objects: Here's the code I've so far, it works by reloading the entire page. ** just to make sense: *pipeline is the frontend DataBase handler. # THE VIEW #################### def index( request ): if request.method == 'POST': # If the form has been submitted... assetMgr = AssetManager( request.POST ) assetMgr.update( request.POST ) else: assetMgr = AssetManager() return render_to_response('inventory/templateSeq.html', {'asset': assetMgr, 'post': request.POST}) # THE FORM ################### class AssetManager( forms.Form ): ## Get productions listProd = [ ( x ,x ) for x in pipeline.productions() ] ## Create fields and onchange calls. project = forms.ChoiceField( choices = listProd, label='', initial=None ) project.widget.attrs["onchange"]="this.form.submit()" type = forms.ChoiceField( required=False, label='', initial=None ) type.widget.attrs["onchange"]="this.form.submit()" def update( self, POST ): """ Update Project & Type fields """ proj = pipeline.getChildren( POST.get('project') ) self.fields['type'].choices = [ ( str(x.name), str(x.name) ) for x in proj.children ] if POST.get('type'): path = "/%s/%s"%( POST.get('project'), POST.get('type') ) children = pipeline.getChildren(path) self.fields[ 'type' ].choices = [ ( x, x ) for x in children ] --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---