Менеджер недоступен через экземпляры моделиPython

Программы на Python
Anonymous
Менеджер недоступен через экземпляры модели

Сообщение Anonymous »

Я пытаюсь получить экземпляр объектов модели в другом и выдаю следующую ошибку:

Менеджер недоступен через экземпляр темы

Вот моя модель:
class forum(models.Model):
# Some attributs

class topic(models.Model):
# Some attributs

class post(models.Model):
# Some attributs

def delete(self):
forum = self.topic.forum
super(post, self).delete()
forum.topic_count = topic.objects.filter(forum = forum).count()

Вот мое мнение:
def test(request, post_id):
post = topic.objects.get(id = int(topic_id))
post.delete()

И я получаю:
post.delete()
forum.topic_count = topic.objects.filter(forum = forum).count()
Manager isn't accessible via topic instances


Подробнее здесь: https://stackoverflow.com/questions/387 ... -instances

Вернуться в «Python»