Re: Iterating over fields in Formset
On Mon, Aug 12, 2013 at 5:47 AM, Dan Gentry wrote: > What is the purpose of checking test.id for a value of 3 or 6? > For test.id == 3 or 6, some other code will be executed, else this code. I am currently doing for else part. -- Sandeep Kaur E-Mail: mkaurkha...@gmail.com Blog: sandymadaan.wordpress.com -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: Iterating over fields in Formset
What is the purpose of checking test.id for a value of 3 or 6? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: Iterating over fields in Formset
On Sat, Aug 10, 2013 at 9:00 PM, Satinderpal Singh wrote: > > I think in the your views you are trying to save it under the formsets, try > to save the formsets under the form to save all the required rows. > What should be changed? This is my code : def add_result(request): class RequiredFormSet(BaseFormSet): def __init__(self, *args, **kwargs): super(RequiredFormSet, self).__init__(*args, **kwargs) for form in self.forms: form.empty_permitted = False clas = Class.objects.get(id=request.GET['class']) test = Tests.objects.get(id=request.GET['test']) student = Student.objects.filter(std=clas.id) #for students in student: # student_id = Student.objects.get(id=students.id) if test.id == 3 or test.id == 6: pass else : FAtestFormSet = formset_factory(FAtestForm, max_num=30, formset=RequiredFormSet) if request.method == 'POST': FAtestform_formset = FAtestFormSet(request.POST, request.FILES) if FAtestform_formset.is_valid() : for form in FAtestform_formset.forms: marks = form.save(commit=False) marks.test = test marks.save() return render_to_response('report/marks_filled.html', {'student':student}, context_instance=RequestContext(request)) else: FAtestform_formset = FAtestFormSet() temp = {'FAtestform_formset': FAtestform_formset, 'student':student, 'test':test } return render_to_response('report/add_marks.html', temp, context_instance = RequestContext(request)) -- Sandeep Kaur E-Mail: mkaurkha...@gmail.com Blog: sandymadaan.wordpress.com -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: Iterating over fields in Formset
On Aug 10, 2013 5:48 PM, "Sandeep kaur" wrote: > > On Fri, Aug 9, 2013 at 2:50 PM, Sandeep kaur wrote: > > I have my code for formset here : > > > > {% csrf_token %} > > > Your help would be really appreciated. > Waiting. > > -- > Sandeep Kaur > E-Mail: mkaurkha...@gmail.com > Blog: sandymadaan.wordpress.com I think in the your views you are trying to save it under the formsets, try to save the formsets under the form to save all the required rows. -- Satinderpal Singh -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.
Re: Iterating over fields in Formset
On Fri, Aug 9, 2013 at 2:50 PM, Sandeep kaur wrote: > I have my code for formset here : > > {% csrf_token %} > Your help would be really appreciated. Waiting. -- Sandeep Kaur E-Mail: mkaurkha...@gmail.com Blog: sandymadaan.wordpress.com -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.