I'm working now on ticket #30463 
<https://code.djangoproject.com/ticket/30463>, and I've figured out what 
the problem is. Here, when self._meta_ordering is called, it returns 
instances of OrderBy type and, when .join is called on that list, it throws 
an error saying: expected str instance but OrderBy found. One easy solution 
is already mentioned in the ticket, which suggests using "', '".join*([*str
*(*f*)* for f in self._meta_ordering*]**).  *But this causes a problem 
since we don't want quotes around OrderBy, and we do want quotes around 
anything inside F(), (i.e we want F('anything')). Moreover, we can not use ", 
".join instead of "', '".join  since we also want quotes around items if 
query expression is not used. 

So, the simple solution which came to my mind after thinking for some time 
was, to call one more string method on "', '".join*([*str*(*f*)* for f 
in self._meta_ordering*]**), * to replace `OrderBy with OrderBy and )' with 
). I'm not sure this is a cleaner solution to this problem, but any other 
solution did not come to my mind. Also, there will be a problem in 
replacement of F( ) with F(' '). I think we'll need to use regular 
expressions in this replacement. 

Any thoughts or comments on my solution? Or is there any better solution 
anyone can think of about this ticket?

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/a4762531-dd0c-4ece-9d8e-b07a35e2b7e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to