when opeing in development everything is ok but when i open from admin site (production) to add new photo i get:
relation "mysite_photo" does not exist LINE 1: SELECT COUNT(*) AS "__count" FROM "mysite_photo"
and the main site will give error:
relation "mysite_photo" does not exist LINE 1: ...to"."doc_file", "mysite_photo"."description" FROM "mysite_ph... ^
here is my photo model:
class Photo(models.Model):
category = models.ForeignKey(Category_docs, on_delete=models.SET_NULL, null=True)
image = models.ImageField(upload_to='docs_images/',null=False, blank=False)
doc_file = models.FileField(upload_to='docs_files/',null=True, blank=True)
description = models.TextField(default="none")
def __str__(self):
return self.description
and this line in docs.html is causing the error:
{% for photo in photos %}
<div class="col-md-4">
<div class="card my-2">
<img class="image-thumbnail" src="{{photo.image.url}}" alt="Card image cap">
<div class="card-body">
<small>Name: {{photo.description}}</small>
<br/>
<small>Category: {{photo.category.name}}</small>
</div>
<a href="{% url 'detail' photo.id %}" class="btn btn-outline-dark btn-sm m-1">View</a>
</div>
</div>
{% empty %}
<h3>No Files to show!</h3>
{% endfor %}
and this is the function in view.py
def docs(request):
category = request.GET.get('category')
if category == None:
photos = Photo.objects.all()
else:
photos = Photo.objects.filter(category=category)
categories = Category_docs.objects.all()
context = {'categories': categories, 'photos':photos}
return render(request, 'docs/docs.html', context)