I'm working on Satchmo, which last version require django 1.3,

    http://www.satchmoproject.com/docs/dev/requirements.html

but with 1.3 there is an ordering problem as said here:

    https://docs.djangoproject.com/en/dev/ref/models/options/#ordering

"Changed in Django 1.4: The Django admin honors all elements in the list/tuple; before 1.4, only the first one was respected."

So i have

-----------------models.py-------------------------------------------------------------------------
class Collection(models.Model):
collection_prdct = models.ForeignKey(Product, verbose_name=_('Base Product'), related_name="test_cllctn", on_delete=models.PROTECT) product = models.ForeignKey(Product, verbose_name=_('Collection Product'), on_delete=models.PROTECT)
    qta = models.IntegerField(default=1, verbose_name=_('Quantity'))
    discount = models.ForeignKey(Discount, verbose_name=_('Discount'))
ordr = models.IntegerField(_("Ordering"), default=0, help_text=_("Shipping order"))

    def __unicode__(self):
return u"Coll.: %s - %s" % (self.collection_prdct, self.product)

    class Meta:
        ordering = ('collection_prdct','ordr',)
        verbose_name = _('Collection model')
        verbose_name_plural = _('Collection models')
end -----------------models.py-------------------------------------------------------------------------

I think that i can do a callable that return a virtual merged field which order on...
something like

def _merged_field(self):
      return u'%s%i' % (self.collection_prdct, self.order)
merged_field = property(_merged_field)

and change
        ordering = ('collection_prdct','ordr',)
to
        ordering = ('merged_field',)

but it gives me
    "ordering" refers to "mergedfield", a field that doesn't exist.

Do i miss something?...or
What is the best way to have it order by two or more fields, expecially in the admin list_view?

Thanks to all
Kooliah





--
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.

Reply via email to