예제 #1
0
class RangeVote(Vote):
    attribute = models.CharField(
        max_length=100,
        validators=[ValueListValidator(valid_values=['creepiness'])])
    value = models.IntegerField(
        validators=[MinValueValidator(1),
                    MaxValueValidator(100)])
예제 #2
0
class BooleanProductVote(ProductVote):
    attribute = models.CharField(
        max_length=100,
        validators=[ValueListValidator(valid_values=['confidence'])])
    product = models.ForeignKey(Product,
                                on_delete=models.CASCADE,
                                related_name='boolean_product_votes')
class BooleanVote(Vote):
    attribute = models.CharField(
        max_length=100,
        validators=[
            ValueListValidator(valid_values=['confidence'])
        ]
    )
    value = models.BooleanField()
예제 #4
0
class RangeProductVote(ProductVote):
    attribute = models.CharField(
        max_length=100,
        validators=[ValueListValidator(valid_values=['creepiness'])])
    average = models.IntegerField(validators=(MinValueValidator(1),
                                              MaxValueValidator(100)))
    product = models.ForeignKey(
        Product,
        on_delete=models.CASCADE,
        related_name='range_product_votes',
    )
class RangeVoteBreakdown(VoteBreakdown):
    product_vote = models.ForeignKey(
        RangeProductVote,
        on_delete=models.CASCADE
    )
    bucket = models.IntegerField(
        validators=[
            ValueListValidator(
                valid_values=[0, 1, 2, 3, 4]
            )
        ]
    )
class BooleanVoteBreakdown(VoteBreakdown):
    product_vote = models.ForeignKey(
        BooleanProductVote,
        on_delete=models.CASCADE
    )
    bucket = models.IntegerField(
        validators=[
            ValueListValidator(
                valid_values=[0, 1]
            )
        ]
    )