from django.db import models
from django.core.validators import MaxValueValidator, MinValueValidator


class Rating(models.Model):
    """
    Rating model for ratings.
    """
    from_user = models.ForeignKey('auth.User',
                                  related_name="ratings_made",
                                  on_delete=models.CASCADE,
                                  )
    to_user = models.ForeignKey('auth.User',
                                related_name="ratings_received",
                                on_delete=models.CASCADE,
                                )
    created = models.DateTimeField(auto_now_add=True)
    rating = models.IntegerField(validators=[MaxValueValidator(10),
                                             MinValueValidator(0)])

    class Meta:
        constraints = [
            models.UniqueConstraint(fields=['from_user',
                                            'to_user'],
                                    name="unique_rating")
        ]
        ordering = ['created']

8d5b9825eeb7b29f4a0af0bda1db6fe7c89f990c
<mask token>


class Rating(models.Model):
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>


    class Meta:
        constraints = [models.UniqueConstraint(fields=['from_user',
            'to_user'], name='unique_rating')]
        ordering = ['created']

<mask token>


class Rating(models.Model):
    <mask token>
    from_user = models.ForeignKey('auth.User', related_name='ratings_made',
        on_delete=models.CASCADE)
    to_user = models.ForeignKey('auth.User', related_name=
        'ratings_received', on_delete=models.CASCADE)
    created = models.DateTimeField(auto_now_add=True)
    rating = models.IntegerField(validators=[MaxValueValidator(10),
        MinValueValidator(0)])


    class Meta:
        constraints = [models.UniqueConstraint(fields=['from_user',
            'to_user'], name='unique_rating')]
        ordering = ['created']

<mask token>


class Rating(models.Model):
    """
    Rating model for ratings.
    """
    from_user = models.ForeignKey('auth.User', related_name='ratings_made',
        on_delete=models.CASCADE)
    to_user = models.ForeignKey('auth.User', related_name=
        'ratings_received', on_delete=models.CASCADE)
    created = models.DateTimeField(auto_now_add=True)
    rating = models.IntegerField(validators=[MaxValueValidator(10),
        MinValueValidator(0)])


    class Meta:
        constraints = [models.UniqueConstraint(fields=['from_user',
            'to_user'], name='unique_rating')]
        ordering = ['created']

from django.db import models
from django.core.validators import MaxValueValidator, MinValueValidator


class Rating(models.Model):
    """
    Rating model for ratings.
    """
    from_user = models.ForeignKey('auth.User', related_name='ratings_made',
        on_delete=models.CASCADE)
    to_user = models.ForeignKey('auth.User', related_name=
        'ratings_received', on_delete=models.CASCADE)
    created = models.DateTimeField(auto_now_add=True)
    rating = models.IntegerField(validators=[MaxValueValidator(10),
        MinValueValidator(0)])


    class Meta:
        constraints = [models.UniqueConstraint(fields=['from_user',
            'to_user'], name='unique_rating')]
        ordering = ['created']

from django.db import models
from django.core.validators import MaxValueValidator, MinValueValidator


class Rating(models.Model):
    """
    Rating model for ratings.
    """
    from_user = models.ForeignKey('auth.User',
                                  related_name="ratings_made",
                                  on_delete=models.CASCADE,
                                  )
    to_user = models.ForeignKey('auth.User',
                                related_name="ratings_received",
                                on_delete=models.CASCADE,
                                )
    created = models.DateTimeField(auto_now_add=True)
    rating = models.IntegerField(validators=[MaxValueValidator(10),
                                             MinValueValidator(0)])

    class Meta:
        constraints = [
            models.UniqueConstraint(fields=['from_user',
                                            'to_user'],
                                    name="unique_rating")
        ]
        ordering = ['created']
