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 .
|
virtualenv .
|
||||||
source bin/activate
|
source bin/activate
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
|
```
|
||||||
|
DB is in docker container
|
||||||
|
```
|
||||||
|
docker compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
python manage.py migrate
|
python manage.py migrate
|
||||||
python manage.py createsuperuser
|
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
|
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.
|
es.
|
||||||
```
|
```
|
||||||
|
|
|
@ -41,6 +41,7 @@ INSTALLED_APPS = [
|
||||||
'rest_framework',
|
'rest_framework',
|
||||||
'suitablephones',
|
'suitablephones',
|
||||||
'corsheaders',
|
'corsheaders',
|
||||||
|
'debug_toolbar',
|
||||||
]
|
]
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
|
@ -52,6 +53,7 @@ MIDDLEWARE = [
|
||||||
'django.contrib.messages.middleware.MessageMiddleware',
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
'corsheaders.middleware.CorsMiddleware',
|
'corsheaders.middleware.CorsMiddleware',
|
||||||
|
'debug_toolbar.middleware.DebugToolbarMiddleware',
|
||||||
]
|
]
|
||||||
|
|
||||||
CORS_ORIGIN_WHITELIST = [
|
CORS_ORIGIN_WHITELIST = [
|
||||||
|
|
|
@ -5,3 +5,4 @@ markdown
|
||||||
django-filter
|
django-filter
|
||||||
psycopg2-binary
|
psycopg2-binary
|
||||||
django-cors-headers
|
django-cors-headers
|
||||||
|
django-debug-toolbar
|
||||||
|
|
|
@ -10,6 +10,7 @@ import subprocess
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def update_repo():
|
def update_repo():
|
||||||
devicesdir = settings.LINEAGEWIKI
|
devicesdir = settings.LINEAGEWIKI
|
||||||
pull_status = subprocess.run(["git", "pull"], cwd=devicesdir)
|
pull_status = subprocess.run(["git", "pull"], cwd=devicesdir)
|
||||||
|
|
|
@ -12,9 +12,9 @@ class SingleDeviceViewSet(viewsets.ModelViewSet):
|
||||||
serializer_class = DeviceSerializer
|
serializer_class = DeviceSerializer
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
codename = self.request.query_params.get('codename')
|
params = self.request.query_params.get('search')
|
||||||
if codename:
|
if params:
|
||||||
self.queryset = self.queryset.filter(codename__icontains=codename)
|
self.queryset = self.queryset.filter(codename__icontains=params) | self.queryset.filter(name__icontains=params) | self.queryset.filter(vendor__icontains=params)
|
||||||
return self.queryset
|
return self.queryset
|
||||||
|
|
||||||
# ViewSets define the view behavior.
|
# ViewSets define the view behavior.
|
||||||
|
|
Loading…
Reference in a new issue