Beispiel #1
0
class PlaylistSerializer(Serializer):
    name = models.CharField(max_length=60)
    genre = models.CharField(max_length=60)
    andamento = models.ValueRange(0, 10)
    limit = models.ValueRange(20, 50)

    class Meta:
        fields = ['name', 'genre', 'andamento', 'limit']
Beispiel #2
0
class MovieReview(models.Model):
    title = models.CharField(max_length=255, blank=True, null=False)
    cover = models.ImageField(default='default_cast.png', upload_to="gallery")
    YEAR_CHOICES = []
    for r in range(1900, (datetime.datetime.now().year + 1)):
        YEAR_CHOICES.append((r, r))
    year = models.IntegerField(choices=YEAR_CHOICES,
                               default=datetime.datetime.now().year)
    GENRE_CHOICES = Choices('Action', 'Comedy', 'Drama', 'Family', 'Romance',
                            'Sci-Fi')
    genre = models.CharField(choices=GENRE_CHOICES, max_length=255, null=False)
    time = models.IntegerField(blank=True, null=False, default=0)
    release_date = models.DateField(default=datetime.date.today)
    description = models.TextField(max_length=255, blank=True, null=False)
    country = CountryField(default='US', null=False)
    movie_language = LanguageField(default='En', null=False)
    IMDB_rating = models.FloatField(max_length=255, blank=True, null=True)
    MPAA_rating = models.IntegerField(blank=True, null=True)
    date_created = models.DateField(default=datetime.date.today)
    alcohol = models.ValueRange(start=0, end=5)
    nudity = models.ValueRange(start=0, end=5)
    LGBTQ = models.ValueRange(start=0, end=5)
    sex = models.ValueRange(start=0, end=5)
    language = models.ValueRange(start=0, end=5)
    violence = models.ValueRange(start=0, end=5)

    def __str__(self):
        return self.title
Beispiel #3
0
class Comment(models.Model):
    title = models.CharField(max_length=255, blank=True, null=False)
    content = models.TextField(blank=True, null=False)
    date_added = models.DateField(default=datetime.date.today)
    likes = models.IntegerField(default=0)
    dislikes = models.IntegerField(default=0)
    alcohol = models.ValueRange(start=0, end=5)
    nudity = models.ValueRange(start=0, end=5)
    sex = models.ValueRange(start=0, end=5)
    LGBTQ = models.ValueRange(start=0, end=5)
    language = models.ValueRange(start=0, end=5)
    violence = models.ValueRange(start=0, end=5)
    memberID = models.ForeignKey(Member, on_delete=models.CASCADE, null=True)
    reviewID = models.ForeignKey(MovieReview,
                                 on_delete=models.CASCADE,
                                 null=True)

    def __str__(self):
        return self.title
Beispiel #4
0
class LoginModel(models.Model):
    username = models.CharField(max_length=264)
    Table_number = models.ValueRange(start=1, end=10)

    def __str__(self):
        return "%s" % self.username