model:
class Dates(models.Model):
this_date = models.DateField()
class Booking(models.Model)
seats = models.IntegerField()
date = models.ForeignKey(Dates)
report view:
this_date = "01-01-2000"
seats = 0
daily_arrivals = []
all = Booking.objects.all()
for a in all:
while a.date != this_date:
seats += seats
daily_seats.append("%s - %s" % (a.date, a.seats)
this_date = a.date
What I am trying to get at is a total of seats by date as a list to send to a template
Anyone got any better way of doing this cos this sure isn't working too well
Cheers
-- class Dates(models.Model):
this_date = models.DateField()
class Booking(models.Model)
seats = models.IntegerField()
date = models.ForeignKey(Dates)
report view:
this_date = "01-01-2000"
seats = 0
daily_arrivals = []
all = Booking.objects.all()
for a in all:
while a.date != this_date:
seats += seats
daily_seats.append("%s - %s" % (a.date, a.seats)
this_date = a.date
What I am trying to get at is a total of seats by date as a list to send to a template
Anyone got any better way of doing this cos this sure isn't working too well
Cheers
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0788d066-3b45-4c4a-b019-74120d31fccc%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment