I have a django template containing 2 buttons. One is for show and another 
is for print. 

I am getting a list of objects from model to print. And there is a status 
field boolean in this model. The issue is after taking print, I want to 
update those objects by making their status field true .

My code is here:

def msss_loan_marking_print_for_period(request, template_name=None):
    site_prof = SiteProfile.objects.all()
    fin_year = site_prof[0].current_financial_year()
    context = {}
    data1=[]
    total=0

    msss = request.session['cur_msss']
    if request.method == 'POST':
        form = SentToBankReportForm(request.POST)
        if form.is_valid():
            action = request.POST.get('action', None)
            from_date = form.cleaned_data.get('start_date')
            to_date = form.cleaned_data.get('end_date')
            category = form.cleaned_data.get('type')
            branch = form.cleaned_data.get('branch')
            sent_status = form.cleaned_data.get('sent_status')

      if action=='print':

                          context = {
                    'total': total,
                    # 'object_list':data1,
                    'objects':objects,
                    'category': category,
                    'start_date': from_date,
                    'action': action,
                    'end_date': to_date,
                    'msss': msss
                }
                template_name = 
'dmis/msss/msss_shg_loan_marking_report.html'
                objects.update(sent_to_bank_status=True)
                return pdf_utils.render_to_pdf_response(template_name, 
context, 'loan_list.pdf') 

I understood that we cant update the field lik 
that(objects.update(status=True)) in this problem. Is there any solution to 
make the model objects updated through djamgo template?? 

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f57dcc2f-5f16-46c3-836a-2b375748ab0a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to