Hi all, I keep running into a problem. Often when creating models for existing databases which you can not modify, I find myself in need of quite a few model methods. That all works fine but then when I run a view I would like to be able to use the object mapper to filter by the method on a model. In other word often I need a virtual database field that gets calculated on the fly. I know I could just modify the queryset but what if I have thousands and thousands of data to analyse and just need a few results. For example:
class Person(models.Model): name = models.CharField(.......) def compare_to_other(self): ....code..... return X now in a view I would like to be able to: results = Person.objects.filter(compare_to_others__gte = 1) I am not sure if I am just using bad practice that I run into this problem or not. I hope someone can point me in the right direction. I do not want to use custom sql and often the analysis is too complicated for Sql Thanks --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---