I have a problem with migration in this model. So this is my initial class Post, it works perfectly(migration worked):
Initial Class Post
class Post(models.Model):
title = models.CharField(max_length=100)
content = models.TextField()
date_posted = models.DateTimeField(default=timezone.now)
author = models.ForeignKey(User, on_delete=models.CASCADE)
def __str__(self):
return self.title
I want to add a new column:
photos = models.ImageField(upload_to="/images/", default = None)
I deleted all migrations and so when i used makemigrations it works, but when i try to migrate i get nothing:
PowerShell Result:
Apply all migrations: blog
Running migrations:
No migrations to apply.
When i try to fake migrations it also is not working:
PowerShell Result:
Target specific migration: 0001_initial, from blog
Running migrations:
No migrations to apply.
After i run the server i get this error:
Trying to acces my local website:
Error during template rendering
In template C:\Users\Administrator PC\Desktop\mysite\blog\templates\blog\base.html, error at line 6
no such column: blog_post.photos
{% load static %}
<!DOCTYPE html>
<html>
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="{% static 'blog/main.css' %}">
{% if title %}
<title>Django Blog - {{ title }}</title>
Please help i don't know what to try more. Thank you in advance.