Re: Django 1.3 Ordering by two or more fields workaround ??
On 06/03/2012 02:41 PM, kooliah wrote:
>
> 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.
Sorry I mistake the pasted code the correct one is
def _mergedfield(self):
return u'%s%i' % (self.collection_prdct, self.ordr)
mergedfield = property(_mergedfield)% (self.collection_prdct,
self.product)
class Meta:
ordering = ('mergedfield',)
Otherwise it would seem a stupid syntax error :-)
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home