This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Функия для сортировки тредам по последним ответам или дате создания | |
threads = Thread.objects.all().prefetch_related('posts') | |
def thread_list_f(threads): | |
work_list = [] | |
thread_list = [] | |
for element in threads: | |
try: | |
work_list.append(element.posts.all()[::-1][0].post_time) | |
except IndexError: | |
work_list.append(element.thread_time) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def f1(x): | |
x = x | |
def f2(y): | |
x += y | |
return x | |
return f2 | |
(defn f1 [x] | |
(let [x (atom x)] | |
(fn [y] |