Hi , I have pasted the code here , when i try to edit it always enters the else condition. delete works fine Please assist.
if request.method == 'GET': #if request.has_key('edit_id'): if 'edit_id' in request.GET: # replace default form with form based on row to edit try: tst = TEST_QST.objects.get(pk=request.GET['edit_id']) import logging logging.debug("INSIDE 'edit_id' in request.GET :::::::::: ----- %s" %tst.qst_id ) logging.debug("INSIDE 'edit_id' in request.GET :::::::::: ----- >%s" %request.GET['edit_id'] ) SaveQstForm = forms.form_for_instance(tst) SaveQstForm.base_fields['qst'].widget = widgets.Textarea(attrs={'label': 'xxx'}) #SaveQstForm.base_fields['qst']=forms.CharField(label='', widget=forms.Textarea(attrs={'name': 'qst'})) SaveQstForm.base_fields['test_id'].widget = widgets.HiddenInput() SaveQstForm.base_fields['test_cat_id'].widget = widgets.HiddenInput() SaveQstForm.base_fields['status'].widget = widgets.HiddenInput() SaveQstForm.base_fields['active'].widget = widgets.HiddenInput() form= SaveQstForm() submit_action = 'Update' edit_id = request.GET['edit_id'] message = 'Editing Question ' + request.GET['edit_id'] logging.debug("INSIDE 'edit_id' in request.GET :::::::::: ----- %s" %request.GET['edit_id'] ) except Exception, e: import logging logging.error('%s while editing' % (e)) if 'delete_id' in request.GET: try: import logging logging.debug("----- INSIDE 'delete_id' in request.GET :::::::: <----->%s" %request.GET['delete_id']) TEST_QST.objects.get(pk=request.GET['delete_id']).delete() q_list = TEST_QST.objects.all() form= QstForm() message = 'Question deleted.' except Exception, e: q_list = TEST_QST.objects.all() form= QstForm() message = 'Error Deleting question !!!!!!!!!' else: import logging logging.debug("----- Inside all Other get Request :::::::: <----->" ) data = {'qst_id': '1', 'test_id': request.session['ttype'], 'test_cat_id': request.session['tcat'], 'qst': 'please enter text here', 'status': '1' , 'active': '1' } form = QstForm(data) return render_to_response('editor1.html', { 'form': form, 'submit_action': submit_action }) Thanks & regards Shreyas --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---