On Thu, Aug 4, 2011 at 2:14 PM, nixlists <nixmli...@gmail.com> wrote: > I need to rewrite the view so that for each object I need to make a > simple calculation based on the data in the fields of that object
you can simply add a method to your model class: class Claim(models.Model): contract = models.ForeignKey(Contract) ndc = models.ForeignKey(Product) ... quantity = models.IntegerField(blank=True, null=True) def mycalc(self) return self.quantity * ndc # or whatever you need to calculate then, in your template you can simply use: {% for c in claims%} {{ c.mycalc }} {% endfor %} -- Javier -- 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.