mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-24 04:13:12 +00:00
17 lines
540 B
Python
17 lines
540 B
Python
|
from django.db.models import Q
|
||
|
from simple_search import BaseSearchForm
|
||
|
|
||
|
from users.models import User, School
|
||
|
|
||
|
class UserSearchForm(BaseSearchForm):
|
||
|
class Meta:
|
||
|
base_qs = User.objects
|
||
|
search_fields = ('^name', 'description', 'specifications', '=id')
|
||
|
|
||
|
# assumes a fulltext index has been defined on the fields
|
||
|
# 'name,description,specifications,id'
|
||
|
fulltext_indexes = (
|
||
|
('name', 2), # name matches are weighted higher
|
||
|
('name,description,specifications,id', 1),
|
||
|
)
|