mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 11:23:10 +00:00
Add plaintext representation for Query
This commit is contained in:
parent
e51038c07b
commit
8a2a13748f
1 changed files with 8 additions and 2 deletions
|
@ -69,6 +69,13 @@ class Query:
|
|||
self.subqueries.append(Query(self.text))
|
||||
self.text = ""
|
||||
|
||||
@property
|
||||
def plaintext(self):
|
||||
if self.operator is not None:
|
||||
return self.operator.join([q.plaintext for q in self.subqueries])
|
||||
|
||||
return self.text
|
||||
|
||||
|
||||
def is_int(variable):
|
||||
""" Check if the variable can be casted to an integer """
|
||||
|
@ -236,9 +243,8 @@ def search_single_word(word, filters, user, start, end, user_state, aff):
|
|||
# Rooms
|
||||
if "5" in aff and Room.can_view_all(user):
|
||||
filter_rooms = (
|
||||
Q(details__icontains=word) | Q(name__icontains=word) | Q(port__details=word) | Q(building__name__icontains=building)
|
||||
Q(details__icontains=word) | Q(name__icontains=word) | Q(port__details=word) | Q(building__name__icontains=word)
|
||||
)
|
||||
filter_rooms |= (Q(name__icontains=room) & Q(building__name__icontains=building))
|
||||
|
||||
filters["rooms"] |= filter_rooms
|
||||
|
||||
|
|
Loading…
Reference in a new issue