From 0b619f85f10012bb50837baea8765af237f5b99d Mon Sep 17 00:00:00 2001 From: d0c Date: Fri, 20 Jan 2023 16:04:40 +0100 Subject: [PATCH] model complete --- suitablephones/models.py | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/suitablephones/models.py b/suitablephones/models.py index 622dadb..d2218b7 100644 --- a/suitablephones/models.py +++ b/suitablephones/models.py @@ -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 = + battery = models.JSONField(default=dict) architecture = models.CharField(max_length=100) - #before_install = + 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 = + 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 = - #models = - #peripherals = + 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 = - #sdcard = + 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):