Revised the order in the search query in the accounting application.

This commit is contained in:
依瑪貓 2020-09-04 19:43:06 +08:00
parent b92b7fb489
commit c1446df532

View File

@ -786,13 +786,13 @@ def search(request: HttpRequest) -> HttpResponse:
| Q(transaction__pk=int(query))\
| Q(account__pk=int(query))
try:
date = datetime.datetime.strptime(query, "%Y")
conditions = conditions\
| Q(transaction__date__year=date.year)
conditions = conditions | Q(transaction__date=parse_date(query))
except ValueError:
pass
try:
conditions = conditions | Q(transaction__date=parse_date(query))
date = datetime.datetime.strptime(query, "%Y")
conditions = conditions\
| Q(transaction__date__year=date.year)
except ValueError:
pass
try: