Re: what if I need to use two objects to get a third object in my templates?

2010-02-21 Thread Jeremy Dillworth
On Feb 21, 11:14 am, Jeremy Dillworth <jdillwo...@gmail.com> wrote: > and a view named list: > > def list(request): >     people = Person.objects.all() >     for p in people: >         p.columns = [None, None, None] >         for c in DataPoint.objects.f

Re: what if I need to use two objects to get a third object in my templates?

2010-02-21 Thread Jeremy Dillworth
You could also put a columns property onto each person object. Given the models: class Person(models.Model): name = models.CharField(max_length=30) class DataPoint(models.Model): person = models.ForeignKey(Person) value = models.IntegerField() and a view named list: def

Re: Model for debt, credit and balance

2010-02-19 Thread Jeremy Dillworth
Presumably you'll eventually have enough transactions that you'll want to start paging them. At that point, it would change how you would arrive at the balance. If a user is looking at page 30, you shouldn't need to retrieve the transactions from pages 1-29. Eventually, you may want to consider

Re: Python-specific question: variable scope

2007-03-30 Thread Jeremy Dillworth
Here's a few ideas: Solution 1 - use the __main__ module The downside to this is that it always reads x from the "top-level" module, in other words, the script that is being run. So when you run a1, you'll get "a1" when you run a2 module b will then find "a2". a1.py -- import