summaryrefslogtreecommitdiff
path: root/pedidos-ya/app/opinion/models.py
blob: 8e66111de9b4e5734bae2974d730f57a2493529d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from django.db import models
from django.core.validators import MinValueValidator, MaxValueValidator

from core.models import TimeStampMixin


class Opinion(TimeStampMixin):
    """Opinion data"""
    user_id = models.CharField(max_length=255)
    store_id = models.CharField(max_length=255)
    purchase_id = models.CharField(max_length=255)
    comment = models.CharField(max_length=255)
    score = models.IntegerField(default=1, validators=[
        MinValueValidator(1), MaxValueValidator(5)
    ])

    def __str__(self):
        return f'{self.user_id} {self.store_id}'