On Wed, Sep 19, 2012 at 10:19 PM, Navnath Gadakh <navnathgad...@gmail.com> wrote: > i am fetching multiple rows? > i have already used > for offer in offers: > print offer.effective _date > but didnt work.my code is > my_offers = > Offer.objects.filter(offer_id=coupon.offer_id_id,is_active=True) > for offer in my_offers: > print offer.effective_date > > HTML = HTML + "<div>" > HTML = HTML + "<b>Offer Description : > </b>"+offer.description+"<br>" > HTML = HTML + "<b>Coupon Number : > </b>"+coupon_no.coupon_detail+"<br>" > HTML = HTML + "<b>Effective Date : > </b>"+str(offer.effective_date)+"<br>" > HTML = HTML + "<b>Expiration Date : > </b>"+str(offer.expiration_date)+"<br>" > HTML = HTML + "<b>Experience Points : > </b>"+str(offer.experience_points)+"<br>" > HTML = HTML + "<b>Discount : > </b>"+str(offer.discount)+"<br>" > #HTML = HTML + "<b>Offer Date : > </b>"+str(coupon_no.date_of_offer)+"<br>" > > HTML = HTML + "<hr>" > HTML = HTML + "</div>"
I'm still confused about the HTML string you have here, but anyway, have you tried either checking that Offer.objects.filter(offer_id=coupon.offer_id_id,is_active=True) is returning something in the shell or adding a __unicode__(self) and then Offer.objects.filter(offer_id=coupon.offer_id_id,is_active=True) for offer in my_offers: print offer to check that your filter is working? cheers L. -- ...we look at the present day through a rear-view mirror. This is something Marshall McLuhan said back in the Sixties, when the world was in the grip of authentic-seeming future narratives. He said, “We look at the present through a rear-view mirror. We march backwards into the future.” http://www.warrenellis.com/?p=14314 -- 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.