from django.contrib.contenttypes.models import ContentType
# В моделе уже можно указать
comment_owner = models.ForeignKey(ContentType, on_delete=models.CASCADE, null=True)
data = {"message":"Hello from QNA, i don't know Django"}
return render(request,template_name, context=data)
class MyView(View):
def get(self, request):
# Делаем так же
data = {"message":"Hello from QNA, i don't know Django"}
return render(request,template_name, context=data)
class PostUpdateView(LoginRequiredMixin, UserPassesTestMixin, UpdateView, CreateView, FormView):
form_class = PostForm1
template_name = 'main/post_form1.html'
model = Post # Вот на отсутствие этого и ругается