I think my problem is both 1 and 2. What happens when you want to use
python modules to analyse the extra field?
For Example:
Database table History:
id | Ordered | Delivered | Invoiced |
1 10 15 5
2 5 5 3
class History(models.Model):
ordered = models.IntegerField()
delivered = models.IntegerField()
Invoiced = models.IntegerField()
def compute_problem(self):
'here will be code that analyses the above data'
if self.ordered > self.delivered:
return self.ordered - self.delivered
if self.invoiced < self.delivered:
return self.delivered - self.invoiced
return 0
Ideally I would like to create the virtual scenario:
id | Ordered | Delivered | Invoiced | compute_problem
1 10 15 5 -5
2 5 5 3 -2
in the view I would like to do the following. Please note that my
compute_problem is a real basic example and I am sure that the above
example I could do in SQL but my methods become a lot more
complicated.
queryset = History.objects.filter().exclude(compute_problem = 0)
I can not modify the database as I am writing add-ons and not creating
the database myself.
I hope this makes a bit more sense. :)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---