Have you tried to change instances to your new tables ?

2012/11/22 Sandeep kaur <[email protected]>:
> I edit value of a table using model instance, however after editing I
> want the values to be saved in some other table with same structure.
> For this to happen I have used following code in views.py :
>
> def editjob(request):
>                 clientjob = ClientJob.objects.get(job_id = query)
>                 if request.method == "POST":
>                         jform = editJobForm(request.POST, instance=job)
>                         sform = editClientJobForm(request.POST, 
> instance=clientjob)
>                         if jform.is_valid() and sform.is_valid():
>                                 jform.save()
>                                 sform.save()
>                                 return
> render_to_response('tcc/succes.html',context_instance=RequestContext(request))
>                 else:
>                         jform = editJobForm(instance=job)
>                         sform = editClientJobForm(instance=clientjob)
>                 return render_to_response('tcc/edit_job.html', {'jform':
> jform,'sform':sform},context_instance=RequestContext(request))
>
> where :
> class editJobForm(forms.ModelForm):
>         class Meta :
>                 model = EditJob
>                 exclude= ['client','job_no','id']
>
> class editClientJobForm(forms.ModelForm):
>
>         class Meta :
>                 model = ClientEditJob
>                 exclude= ['job']
>
> However this code saves the value in same instance itself. What I want
> is to get old values from table: Job and ClientJob and then after
> editing get saved in tables: EditJob and ClentEditJob.
> Is this possible? Your help will be appreciated.
> Thank you.
>
> --
> Sandeep Kaur
> E-Mail: [email protected]
> Blog: sandymadaan.wordpress.com
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to