OMG prev_qs TaskPlace objects filter place__address__lt taskplace plac

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# OMG
prev_qs = TaskPlace.objects.filter(
Q(
Q(place__address__lt=taskplace.place.address) |
Q(
Q(place__address=taskplace.place.address) &
Q(place__id__lt=taskplace.place.id)
)
), task=task, status=taskplace.status). order_by(
'place__address', 'place__code')
next_qs = TaskPlace.objects.filter(
Q(
Q(place__address__gt=taskplace.place.address) |
Q(
Q(place__address=taskplace.place.address) &
Q(place__id__gt=taskplace.place.id)
)
), task=task, status=taskplace.status). order_by(
'place__address', 'place__code')