Skip to content

Commit

Permalink
update model.py
Browse files Browse the repository at this point in the history
  • Loading branch information
최은성 authored and 최은성 committed Dec 31, 2019
1 parent adef805 commit 3c809b7
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 159 deletions.
10 changes: 5 additions & 5 deletions startapp/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
from .models import Marks
# Register your models here.

admin.site.register(Members)
admin.site.register(Cases)
admin.site.register(Membercases)
admin.site.register(Videos)
admin.site.register(Marks)
admin.site.register(Member)
admin.site.register(Case)
admin.site.register(Membercase)
admin.site.register(Video)
admin.site.register(Mark)
189 changes: 35 additions & 154 deletions startapp/models.py
Original file line number Diff line number Diff line change
@@ -1,175 +1,56 @@
# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# * Make sure each ForeignKey and OneToOneField has `on_delete` set to the desired behavior
# * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table
# Feel free to rename the models, but don't rename db_table values or field names.
from django.db import models

# Create your models here.

class AuthGroup(models.Model):
name = models.CharField(unique=True, max_length=150)

class Meta:
managed = False
db_table = 'auth_group'


class AuthGroupPermissions(models.Model):
group = models.ForeignKey(AuthGroup, models.DO_NOTHING)
permission = models.ForeignKey('AuthPermission', models.DO_NOTHING)

class Meta:
managed = False
db_table = 'auth_group_permissions'
unique_together = (('group', 'permission'),)
class Member(models.Model):
memberid = models.CharField(primary_key=True, max_length=50)
memberpw = models.CharField(max_length=50)

def __str__(self):
return "Member ID: %s" % self.memberid

class AuthPermission(models.Model):
name = models.CharField(max_length=255)
content_type = models.ForeignKey('DjangoContentType', models.DO_NOTHING)
codename = models.CharField(max_length=100)

class Meta:
managed = False
db_table = 'auth_permission'
unique_together = (('content_type', 'codename'),)


class AuthUser(models.Model):
password = models.CharField(max_length=128)
last_login = models.DateTimeField(blank=True, null=True)
is_superuser = models.IntegerField()
username = models.CharField(unique=True, max_length=150)
first_name = models.CharField(max_length=30)
last_name = models.CharField(max_length=150)
email = models.CharField(max_length=254)
is_staff = models.IntegerField()
is_active = models.IntegerField()
date_joined = models.DateTimeField()

class Meta:
managed = False
db_table = 'auth_user'


class AuthUserGroups(models.Model):
user = models.ForeignKey(AuthUser, models.DO_NOTHING)
group = models.ForeignKey(AuthGroup, models.DO_NOTHING)

class Meta:
managed = False
db_table = 'auth_user_groups'
unique_together = (('user', 'group'),)


class AuthUserUserPermissions(models.Model):
user = models.ForeignKey(AuthUser, models.DO_NOTHING)
permission = models.ForeignKey(AuthPermission, models.DO_NOTHING)

class Meta:
managed = False
db_table = 'auth_user_user_permissions'
unique_together = (('user', 'permission'),)


class Cases(models.Model):
class Case(models.Model):
caseid = models.AutoField(primary_key=True)
doclink = models.CharField(max_length=300, blank=True, null=True)
hash = models.CharField(max_length=300)
qrlink = models.CharField(max_length=300)

class Meta:
managed = False
db_table = 'cases'


class DjangoAdminLog(models.Model):
action_time = models.DateTimeField()
object_id = models.TextField(blank=True, null=True)
object_repr = models.CharField(max_length=200)
action_flag = models.PositiveSmallIntegerField()
change_message = models.TextField()
content_type = models.ForeignKey('DjangoContentType', models.DO_NOTHING, blank=True, null=True)
user = models.ForeignKey(AuthUser, models.DO_NOTHING)

class Meta:
managed = False
db_table = 'django_admin_log'


class DjangoContentType(models.Model):
app_label = models.CharField(max_length=100)
model = models.CharField(max_length=100)
def __str__(self):
return "%d" % self.caseid

class Meta:
managed = False
db_table = 'django_content_type'
unique_together = (('app_label', 'model'),)


class DjangoMigrations(models.Model):
app = models.CharField(max_length=255)
name = models.CharField(max_length=255)
applied = models.DateTimeField()
class Membercase(models.Model):
membercaseid = models.AutoField(primary_key=True)
member = models.ForeignKey(Member, on_delete=models.CASCADE)
case = models.ForeignKey(Case, on_delete=models.CASCADE)

class Meta:
managed = False
db_table = 'django_migrations'
unique_together = ['member', 'case']

# def case_directory_path(instance, filename):
# file will be uploaded to MEDIA_ROOT/user_<id>/<filename>
# return 'videos/{0}/{1}'.format(instance.case.caseid, filename)

class DjangoSession(models.Model):
session_key = models.CharField(primary_key=True, max_length=40)
session_data = models.TextField()
expire_date = models.DateTimeField()

class Meta:
managed = False
db_table = 'django_session'


class Marks(models.Model):
memberid = models.OneToOneField('Members', models.DO_NOTHING, db_column='memberid', primary_key=True)
caseid = models.ForeignKey('Videos', models.DO_NOTHING, db_column='caseid', related_name='Marks_caseid')
videoid = models.ForeignKey('Videos', models.DO_NOTHING, db_column='videoid', related_name='Marks_videoid')
class Video(models.Model):
upload = models.FileField(upload_to=case_directory_path)
case = models.ForeignKey(Case, on_delete=models.DO_NOTHING)
videoid = models.AutoField(primary_key=True)
videolink = models.CharField(max_length=300)
name = models.CharField(max_length=50)
contact = models.CharField(max_length=100)
email = models.EmailField(max_length=254, null=True)

class Meta:
managed = False
db_table = 'marks'
unique_together = (('memberid', 'caseid', 'videoid'),)


class Membercases(models.Model):
memberid = models.OneToOneField('Members', models.DO_NOTHING, db_column='memberid', primary_key=True)
caseid = models.ForeignKey(Cases, models.DO_NOTHING, db_column='caseid')
unique_together = ['case', 'videoid']

# def __str__(self):
# return "Case %d Video %d" % ( self.case.caseid, self.videoid )

class Mark(models.Model):
markid = models.AutoField(primary_key=True)
member = models.ForeignKey(Member, on_delete=models.CASCADE)
video = models.ForeignKey(Video, on_delete=models.CASCADE)

class Meta:
managed = False
db_table = 'membercases'
unique_together = (('memberid', 'caseid'),)

unique_together = ['member', 'video']

class Members(models.Model):
memberid = models.AutoField(primary_key=True)
id = models.CharField(max_length=50, blank=True, null=True)
pw = models.CharField(max_length=100)

class Meta:
managed = False
db_table = 'members'


class Videos(models.Model):
caseid = models.OneToOneField(Cases, models.DO_NOTHING, db_column='caseid', primary_key=True)
videoid = models.IntegerField()
videolink = models.CharField(max_length=300)
metadata = models.CharField(max_length=300, blank=True, null=True)
thumbnaillink = models.CharField(max_length=300, blank=True, null=True)
videolength = models.IntegerField(blank=True, null=True)
timestamp = models.DateTimeField()

class Meta:
managed = False
db_table = 'videos'
unique_together = (('caseid', 'videoid'),)

0 comments on commit 3c809b7

Please sign in to comment.