Does anyone know if there are plans to fix this...or if there is a work
around? I have several resultsets where I have columns from several
different tables (related by foreignkeys) and I would like to be able
sort on those columns. I had originally just had a javascript function
to do it on my table...but now I've added a paginator into the
mix...and need to actual order the result set.
There are no specific plans that I am aware of (i.e., no schedule that
says 'will be fixed by 25 Jan'). There was talk of a refactoring of
query.py that was to address problems like this one, but the developer
that was championing this cause (Malcolm) has been absent of late.
Obviously, it is a bug, and it would be nice if Django had no bugs,
but the core developers have limited time, and we spend it where we
think it has the most benefit. If someone were to step up and fix this
problem, it would probably find its way into the trunk fairly quickly
(assuming it was a complete patch, of good quality, with unit tests,
etc).
Yours,
Russ Magee %-)
There is a workaround for this problem. I am using the latest
subversion build of django, so I don't know if it works with the last
official build or not.
Here is an example:
ProductVersion.objects.select_related().order_by("kindledb_product.name","version_number")
Here are the model definitions:
class ProductVersion(models.Model):
product=models.ForeignKey(Product)
version_number=models.CharField(maxlength=16)
availability_date=models.DateField(null=True,blank=True)
release_notes=models.TextField(blank=True)
class Product(models.Model):
name=models.CharField(maxlength=128)
Note that kindledb_product is the name of the database table that
stores the information from the Product.
--gordon
I was bitten by this when I specified this sort of ordering in the model...
--
Honza Král
E-Mail: Honza...@gmail.com
ICQ#: 107471613
Phone: +420 606 678585