Re: Treat two fields as one in a queryset

2010-02-21 Thread shacker
Thanks for the suggestions. The "convert to list" approach sounded appealing, but I had to get back a queryset since this was for an RSS feed. After reading up more, finally decided it might actually make more sense to go with a bit of denormalization and create a "combined_date" field on the

Re: Treat two fields as one in a queryset

2010-02-20 Thread Shawn Milochik
If you know how to do it in SQL, just make your own manager. http://docs.djangoproject.com/en/1.1/topics/db/managers/ Yay for Django! Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Treat two fields as one in a queryset

2010-02-20 Thread John M
I think you'll have to sort the list yourself by creating a calculated field, since you're only returning a small number, I don't see this as a big issue. So, get the records back that you want via the ORM, and then copy them over to a list. HTH John On Feb 20, 6:26 pm, shacker

Treat two fields as one in a queryset

2010-02-20 Thread shacker
Given a model like: class Item(models.Model): title = models.CharField(max_length=140) created_date = models.DateTimeField(default=datetime.datetime.now) completed = models.BooleanField(default=False) completed_date = models.DateTimeField(blank=True,null=True) ... I want to