Answer the question
In order to leave comments, you need to log in
What is the model error on Heroku?
I uploaded the site to heroku and for some reason he swears at the model, so the bootstrap hooked
MODELS.PY
from django.db import models
class Post(models.Model):
class Meta():
db_table = "post"
verbose_name = "Новость"
verbose_name_plural = "Новости"
ordering = ["create"]
title = models.CharField("Заголовок", max_length=100)
text = models.TextField("Текст", max_length=1000)
image = models.ImageField("Изображение", upload_to="news/", blank=True)
create = models.DateTimeField("Опубликована", auto_now_add=True)
update = models.DateTimeField("Изменена", auto_now_add=True)
moder = models.BooleanField("Модерация")
def __str__(self):
return self.title
def post_list(request):
post = Post.objects.filter()
return render(request, '../templates/home/home.html', {'posts': post}, locals())
def post_single(request, pk):
post = get_object_or_404(Post, pk=pk)
return render(request, '../templates/home/single_news.html', {'post': post})
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