Django model default sort order using related table field

后端 未结 6 1284
半阙折子戏
半阙折子戏 2020-12-17 08:26

Is it possible to set the default sort order for a model to a field from a related model (rather than the integer key) i.e. something that yields a SQL order by clause with

6条回答
  •  情书的邮戳
    2020-12-17 09:08

    hmm ... I am solving similar thing while upfactoring old django application, written before qs-rf, where "dot" notation was probably used ??? ... it took me few hours to diclose "something" and I am still NOT sure, but ... try to replace dot with "__" (double underscores), this can help, .. In fact, curentlly, I still HOPE TOO :-)))

    @stuart: for "order_with_respect_to", I readed something about automatically added physical model field into child table ... I dont completelly understand how things are here ... IMHO documentation is very bad about ordering syntax, howgh!

    no comment :-) http://code.djangoproject.com/ticket/8975

    anyway, I like Django, yet ... :-))

提交回复
热议问题