Hi,
I deleted a model field (created_date
) on my local django models.py .
Some of the migrations and / or pulls from Github to pythonanywhere must have failed, and I got "No such column" error. I then dropped the table on sqlite, deleted all migrations files and got "table does not exist".
I managed to recreate all migrations, run makemigrations
and migrate
until everything is up to date. But I still get the "no such column" error.
db:
pragma table_info('suquiwrites_entry');
cid name type notnull dflt_value pk
---------- ---------- ---------- ---------- ---------- ----------
0 id integer 1 1
1 title varchar(20 1 0
2 text text 1 0
3 published_ datetime 0 0
4 author_id integer 1 0
sqlite>
models.py:
from django.db import models
from django.conf import settings
from datetime import datetime
class Entry(models.Model):
author = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
title = models.CharField(max_length=200)
text = models.TextField()
published_date = models.DateTimeField(blank=True, null=True)
def publish(self, value):
self.published_date = datetime.strptime(value, "%d-%m-%Y").date()
self.save()
def __str__(self):
return self.title
Error code : Exception Value: no such column: suquiwrites_entry.created_date
Tia