models.py
1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from django.db import models
# Create your models here.
class Item(models.Model):
item_id = models.AutoField(primary_key = True)
is_folder = models.BooleanField(default = False)
name = models.CharField(max_length = 50)
path = models.TextField()
#parent = models.ForeignKey('Item', on_delete=models.CASCADE, null=True) #related_name
parent = models.IntegerField()
user_id = models.IntegerField()
size = models.IntegerField()
is_deleted = models.BooleanField(default = False)
created_time = models.DateTimeField(auto_now=True)
updated_time = models.DateTimeField(null=True)
status = models.BooleanField()
#file = models.FileField(upload_to = \path)
class Meta:
ordering = ['item_id']
class SharedItem(models.Model):
item_id = models.IntegerField()
#file_id?
expires = models.DateTimeField()
password = models.CharField(max_length = 20)
created_time = models.DateTimeField(auto_now=True)
class Meta:
ordering = ['item_id']
class User(models.Model):
int_id = models.IntegerField()
user_id = models.CharField(max_length = 50)
name = models.CharField(max_length = 50)
password = models.CharField(max_length = 20)
total_size = models.IntegerField()
current_size = models.IntegerField()
created_time = models.DateTimeField(auto_now=True)
class Meta:
ordering = ['int_id']