Thanks, that works! (but I already changed my implementation not to
use tag-based ordering...)
For more generality, you could replace bbs_tag with Tag._meta.db_table
value.
On 8월4일, 오후11시25분, krylatij wrote:
> Use extra() method of query set with little hack ;)
>
> mymodel.objects.extra(select={
Use extra() method of query set with little hack ;)
mymodel.objects.extra(select={'ordering_field': 'IF(STRCMP
(bbs_tag.name, 'notice'), '',bbs_tag.name)'},
order_by=['ordering_field'])
--~--~-~--~~~---~--~~
You received this message because you are subscribed to t
I've tried that also, but it ALSO only accepts field names. Its
intention to be there is not to override previously set order clauses.
On 8월4일, 오후5시56분, Daniel Roseman wrote:
> On Aug 4, 8:28 am, Daybreaker wrote:
>
> > I want to run a query like this:
>
> > select * from bbs_article a, bbs_art
Finally I implemented a custom manager.
http://dpaste.com/hold/75010/
But another problem arised, that Django's object_list generic view
only accepts a QuerySet object, not list neither other iterables.
Of course I can implement my own pagination with the given Paginator
class, but this seems no
On Aug 4, 8:28 am, Daybreaker wrote:
> I want to run a query like this:
>
> select * from bbs_article a, bbs_article_tags a2, bbs_tag t where t.id
> = a2.tag_id and a.id = a2.article_id order by (case when t.name =
> 'notice' then '' else t.name end)
>
> which has a custom ordering rule.
>
> As f
I want to run a query like this:
select * from bbs_article a, bbs_article_tags a2, bbs_tag t where t.id
= a2.tag_id and a.id = a2.article_id order by (case when t.name =
'notice' then '' else t.name end)
which has a custom ordering rule.
As far as I know, Django model currently does not support
6 matches
Mail list logo