from __future__ import unicode_literals
from django.db import models
from django.utils import timezone
from django.template.defaultfilters import slugify
from django.urls import reverse
from django.apps import apps
from django.contrib.auth.models import User
# Create your models here.
class Video(models.Model):
STATUS_CHOICES = (
(1, 'Active'),
(0, 'Deactive'),
)
vid_cat_type = models.ForeignKey('category.Categorytype', on_delete=models.CASCADE, null=True, blank=True)
vid_cat = models.ForeignKey('category.Category', on_delete=models.CASCADE, null=True, blank=True)
user = models.ForeignKey(User, on_delete=models.CASCADE, null=True, blank=True)
videorand_id = models.BigIntegerField(null=True,blank=True)
video_name = models.FileField(upload_to='uploadvideo')
country = models.ForeignKey('countries.Countries', on_delete=models.CASCADE, null=True, blank=True)
vid_title = models.CharField(max_length=255)
vid_description = models.TextField(null=True,blank=True)
status = models.IntegerField(choices=STATUS_CHOICES, default=1)
created_at = models.DateTimeField(default=timezone.now,editable=True,blank=True,null=True)
updated_at = models.DateTimeField(auto_now=False,blank=True,null=True)
def __str__(self):
return self.video_name
class Thumbimages(models.Model):
THUMB_TYPE = (
(1, 'Active'),
(0, 'Deactive'),
)
video = models.ForeignKey(Video, on_delete=models.CASCADE, null=True, blank=True)
thumb_image = models.ImageField(upload_to='vidthumbimage',max_length=255,null=True,blank=True)
thumb_type = models.CharField(max_length=1,null=True,blank=True)
activateimg = models.IntegerField(choices=THUMB_TYPE, default=1)
created_at = models.DateTimeField(default=timezone.now,editable=True,blank=True,null=True)
updated_at = models.DateTimeField(auto_now=False,blank=True,null=True)