mirror of
https://github.com/Dadechin/Dashboard-XRoom.git
synced 2025-07-16 07:04:33 +00:00
Compare commits
2 Commits
0338751297
...
caf7acf750
Author | SHA1 | Date | |
---|---|---|---|
caf7acf750 | |||
79656c4ad4 |
|
@ -1,13 +1,20 @@
|
|||
from django.db import models
|
||||
|
||||
class Download(models.Model):
|
||||
# Define choices as a tuple of tuples
|
||||
TYPE_CHOICES = (
|
||||
('android', 'Android'),
|
||||
('windows', 'Windows'),
|
||||
('metaquest', 'Meta Quest'),
|
||||
)
|
||||
|
||||
name = models.CharField(max_length=255)
|
||||
description = models.TextField(blank=True)
|
||||
url = models.URLField(blank=True) # Optional if file is used
|
||||
version = models.CharField(max_length=50)
|
||||
type = models.CharField(max_length=50)
|
||||
type = models.CharField(max_length=50, choices=TYPE_CHOICES) # Updated with choices
|
||||
file = models.FileField(upload_to='downloads/', blank=True, null=True)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.name} ({self.type}) - v{self.version}"
|
||||
return f"{self.name} ({self.type}) - v{self.version}"
|
|
@ -4,4 +4,4 @@ from core.models.download import Download
|
|||
class DownloadSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = Download
|
||||
fields = ['id', 'name', 'description', 'url', 'version', 'type']
|
||||
fields = ['id', 'name', 'description', 'file', 'version', 'type']
|
||||
|
|
Loading…
Reference in New Issue
Block a user