working + docs
This commit is contained in:
parent
b643061fdd
commit
90d4832488
7 changed files with 104 additions and 9 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -60,3 +60,6 @@ docs/_build/
|
||||||
# PyBuilder
|
# PyBuilder
|
||||||
target/
|
target/
|
||||||
|
|
||||||
|
# Virtualenv
|
||||||
|
bin/
|
||||||
|
pyvenv.cfg
|
||||||
|
|
12
Readme.md
12
Readme.md
|
@ -14,4 +14,14 @@ Yaml file descripting all devices are in _"lineage_wiki/_data/devices/"_
|
||||||
|
|
||||||
Set the proper path in var _LINEAGEWIKI_
|
Set the proper path in var _LINEAGEWIKI_
|
||||||
|
|
||||||
TODO: choose where to set _LINEAGEWIKI_
|
TODO: choose where to set _LINEAGEWIKI_
|
||||||
|
|
||||||
|
Installation:
|
||||||
|
```
|
||||||
|
|
||||||
|
git clone https://git.lattuga.net/d0c/suitablephones.git
|
||||||
|
virtualenv .
|
||||||
|
bin/pip install -r requirements.txt
|
||||||
|
bin/python manage.py migrate
|
||||||
|
bin/python manage.py createsuperuser
|
||||||
|
bin/python manage.py startserver
|
||||||
|
|
|
@ -17,7 +17,7 @@ from django.contrib import admin
|
||||||
from django.urls import include, path
|
from django.urls import include, path
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('', include('suitablephones.urls')),
|
path('api-auth/', include('rest_framework.urls')),
|
||||||
path('admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
5
requirements.txt
Normal file
5
requirements.txt
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
Django
|
||||||
|
pyyaml
|
||||||
|
djangorestframework
|
||||||
|
markdown
|
||||||
|
django-filter
|
|
@ -1,3 +1,18 @@
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
# Register your models here.
|
from suitablephones.models import Bluetooth, Camera, Device
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(Camera)
|
||||||
|
class AdminCamera(admin.ModelAdmin):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(Bluetooth)
|
||||||
|
class AdminBluetooth(admin.ModelAdmin):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(Device)
|
||||||
|
class AdminDevice(admin.ModelAdmin):
|
||||||
|
pass
|
||||||
|
|
62
suitablephones/migrations/0001_initial.py
Normal file
62
suitablephones/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
# Generated by Django 4.1.5 on 2023-01-03 10:24
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Bluetooth',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('spec', models.CharField(max_length=100)),
|
||||||
|
('profile', models.CharField(max_length=100)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Camera',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('megapixel', models.DecimalField(decimal_places=1, max_digits=5)),
|
||||||
|
('flash', models.CharField(choices=[('L', 'Led'), ('DL', 'Double Led')], max_length=100)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Device',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('architecture', models.CharField(max_length=100)),
|
||||||
|
('cpu', models.CharField(max_length=100)),
|
||||||
|
('codename', models.CharField(max_length=100)),
|
||||||
|
('cpu_cores', models.CharField(max_length=100)),
|
||||||
|
('cpu_freq', models.CharField(max_length=100)),
|
||||||
|
('download_boot', models.CharField(max_length=100)),
|
||||||
|
('dimensions', models.CharField(max_length=100)),
|
||||||
|
('gpu', models.CharField(max_length=100)),
|
||||||
|
('image', models.CharField(max_length=100)),
|
||||||
|
('install_method', models.CharField(max_length=100)),
|
||||||
|
('kernel', models.CharField(max_length=100)),
|
||||||
|
('name', models.CharField(max_length=100)),
|
||||||
|
('recovery_boot', models.CharField(max_length=100)),
|
||||||
|
('ram', models.CharField(max_length=100)),
|
||||||
|
('recovery_reboot', models.CharField(max_length=100)),
|
||||||
|
('release', models.CharField(max_length=100)),
|
||||||
|
('storage', models.CharField(max_length=100)),
|
||||||
|
('soc', models.CharField(max_length=100)),
|
||||||
|
('tree', models.CharField(max_length=100)),
|
||||||
|
('type', models.CharField(max_length=100)),
|
||||||
|
('vendor', models.CharField(max_length=100)),
|
||||||
|
('vendor_short', models.CharField(max_length=100)),
|
||||||
|
('wifi', models.CharField(max_length=100)),
|
||||||
|
('bluetooth', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='suitablephones.bluetooth')),
|
||||||
|
('cameras', models.ManyToManyField(to='suitablephones.camera')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
|
@ -4,17 +4,17 @@ from django.db import models
|
||||||
|
|
||||||
|
|
||||||
class Bluetooth(models.Model):
|
class Bluetooth(models.Model):
|
||||||
spec = models.CharField(max_lengh=100)
|
spec = models.CharField(max_length=100)
|
||||||
profile = models.CharField(max_lengh=100)
|
profile = models.CharField(max_length=100)
|
||||||
|
|
||||||
|
|
||||||
class Camera(models.Model):
|
class Camera(models.Model):
|
||||||
class FLASHES(models.TextChoices:
|
class FLASHES(models.TextChoices):
|
||||||
LED = 'L', 'Led'
|
LED = 'L', 'Led'
|
||||||
DUAL_LED = 'DL', 'Double Led'
|
DUAL_LED = 'DL', 'Double Led'
|
||||||
|
|
||||||
megapixel = models.DecimalField()
|
megapixel = models.DecimalField(max_digits=5, decimal_places=1)
|
||||||
flash = models.CharField(max_lengh=100, choices=FLASH)
|
flash = models.CharField(max_length=100, choices=FLASHES.choices)
|
||||||
|
|
||||||
#Devices.object.filter(flash=Camera.FLASEHS.LED)
|
#Devices.object.filter(flash=Camera.FLASEHS.LED)
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ class Device(models.Model):
|
||||||
#battery = <class 'dict'>
|
#battery = <class 'dict'>
|
||||||
architecture = models.CharField(max_length=100)
|
architecture = models.CharField(max_length=100)
|
||||||
#before_install = <class 'dict'>
|
#before_install = <class 'dict'>
|
||||||
bluetooth = modle.ForeingKey(Bluetooth)
|
bluetooth = models.ForeignKey(Bluetooth, on_delete=models.CASCADE)
|
||||||
cameras = models.ManyToManyField(Camera)
|
cameras = models.ManyToManyField(Camera)
|
||||||
cpu = models.CharField(max_length=100)
|
cpu = models.CharField(max_length=100)
|
||||||
codename = models.CharField(max_length=100)
|
codename = models.CharField(max_length=100)
|
||||||
|
|
Loading…
Reference in a new issue