Answer the question
In order to leave comments, you need to log in
How to override save() method in Django model?
class ValueRatingPost(models.Model):
""" Модель оценки постов """
user = models.OneToOneField(User, on_delete=models.CASCADE, verbose_name='Пользователь')
rating = models.ForeignKey(Rating, on_delete=models.CASCADE, verbose_name='Оценка')
post = models.ForeignKey(Post, on_delete=models.CASCADE, verbose_name='Запись')
class Meta:
...
def save(self, *args, **kwargs):
...
if User in self.user:
...
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question