model complete

This commit is contained in:
d0c 2023-01-20 16:04:40 +01:00
parent 8054a37c0d
commit 0b619f85f1

View file

@ -1,15 +1,13 @@
from django.contrib.postgres.fields import ArrayField
from django.db import models
# Create your models here.
class Bluetooth(models.Model):
spec = models.CharField(max_length=100)
profiles = models.CharField(max_length=100)
def __str__(self):
return f"Bluetooth: {self.spec} - {self.profiles}"
return f"{self.spec} - {self.profiles}"
class Camera(models.Model):
@ -21,43 +19,43 @@ class Camera(models.Model):
flash = models.CharField(max_length=100, choices=FLASHES.choices)
def __str__(self):
return f"Camera: {self.megapixel} - {self.flash}"
return f"{self.megapixel} - {self.flash}"
class Device(models.Model):
#battery = <class 'dict'>
battery = models.JSONField(default=dict)
architecture = models.CharField(max_length=100)
#before_install = <class 'dict'>
before_install = models.JSONField(default=dict) # dict or str
bluetooth = models.ForeignKey(Bluetooth, on_delete=models.CASCADE)
#cameras = models.ManyToManyField(Camera)
cameras = models.ManyToManyField(Camera)
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)
#current_branch = <class 'float'>
current_branch = models.FloatField(default=None)
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)
#maintainers = <class 'list'>
#models = <class 'list'>
#peripherals = <class 'list'>
kernel = models.CharField(max_length=100)
maintainers = ArrayField(models.CharField(max_length=100), default=None)
device_models = ArrayField(models.CharField(max_length=100), default=None)
peripherals = ArrayField(models.CharField(max_length=100), default=None)
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)
#screen = <class 'dict'>
#sdcard = <class 'dict'>
screen = models.JSONField(default=dict) # dict or str
sdcard = models.JSONField(default=dict) # dict or str{1}
storage = models.CharField(max_length=100)
soc = models.CharField(max_length=100)
tree = models.CharField(max_length=100)
type = models.CharField(max_length=100)
device_type = models.CharField(max_length=100)
vendor = models.CharField(max_length=100)
vendor_short = models.CharField(max_length=100)
versions = ArrayField(models.FloatField())
versions = ArrayField(models.FloatField(default=None), default=None)
wifi = models.CharField(max_length=100)
def __str__(self):