search
This commit is contained in:
parent
386740dd9d
commit
58f19486e8
5 changed files with 15 additions and 4 deletions
|
@ -21,6 +21,13 @@ git clone https://git.lattuga.net/d0c/suitablephones.git
|
|||
virtualenv .
|
||||
source bin/activate
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
DB is in docker container
|
||||
```
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
```
|
||||
python manage.py migrate
|
||||
python manage.py createsuperuser
|
||||
```
|
||||
|
@ -33,7 +40,7 @@ Yaml files descripting all devices are in _"lineage_wiki/_data/devices/"_
|
|||
git clone https://github.com/LineageOS/lineage_wiki.git
|
||||
```
|
||||
|
||||
Set _LINEAGEWIKI_ variable in _mysuitablephone/settings.py_ with the proper path of lineage_wiki.
|
||||
Set _LINEAGEWIKI_ variable in _mysuitablephone/settings_local.py_ with the proper path of lineage_wiki.
|
||||
|
||||
es.
|
||||
```
|
||||
|
|
|
@ -41,6 +41,7 @@ INSTALLED_APPS = [
|
|||
'rest_framework',
|
||||
'suitablephones',
|
||||
'corsheaders',
|
||||
'debug_toolbar',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
|
@ -52,6 +53,7 @@ MIDDLEWARE = [
|
|||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
'corsheaders.middleware.CorsMiddleware',
|
||||
'debug_toolbar.middleware.DebugToolbarMiddleware',
|
||||
]
|
||||
|
||||
CORS_ORIGIN_WHITELIST = [
|
||||
|
|
|
@ -5,3 +5,4 @@ markdown
|
|||
django-filter
|
||||
psycopg2-binary
|
||||
django-cors-headers
|
||||
django-debug-toolbar
|
||||
|
|
|
@ -10,6 +10,7 @@ import subprocess
|
|||
import logging
|
||||
|
||||
|
||||
|
||||
def update_repo():
|
||||
devicesdir = settings.LINEAGEWIKI
|
||||
pull_status = subprocess.run(["git", "pull"], cwd=devicesdir)
|
||||
|
|
|
@ -12,9 +12,9 @@ class SingleDeviceViewSet(viewsets.ModelViewSet):
|
|||
serializer_class = DeviceSerializer
|
||||
|
||||
def get_queryset(self):
|
||||
codename = self.request.query_params.get('codename')
|
||||
if codename:
|
||||
self.queryset = self.queryset.filter(codename__icontains=codename)
|
||||
params = self.request.query_params.get('search')
|
||||
if params:
|
||||
self.queryset = self.queryset.filter(codename__icontains=params) | self.queryset.filter(name__icontains=params) | self.queryset.filter(vendor__icontains=params)
|
||||
return self.queryset
|
||||
|
||||
# ViewSets define the view behavior.
|
||||
|
|
Loading…
Reference in a new issue