When i want to change or add one more model in Models.py , i got this error :
OperationalError at /admin/groups/group/
no such column: groups_group.کد
it only happens when it is the second time that im going to change the model. for the first time it doesnt have any special error.
i run this commands but it doesnt help me :
python manage.py makemigrations
python manage.py migrate
and also :
python manage.py makemigrations appname
python manage.py migrate appname
here is my code :
Models.py:
from django.db import models
class Group(models.Model):
کد = models.IntegerField(max_length = 5, default = 00000)
عنوان = models.CharField(max_length = 30)
توضیحات_شماره_یک = models.CharField(max_length = 100)
توضیحات_شماره_دو = models.CharField(max_length = 100)
توضیحات_شماره_سه = models.CharField(max_length = 100)
Views.py:
from django.shortcuts import render
def groups(request):
return render(request, "groups/groups.html")
def group(request):
return render(request, "groups/group.html")
Urls.py:
from django.urls import path
from . import views
urlpatterns = [
path('', views.groups, name = "groups"),
path('group/', views.group, name = "group")
]
Admin.py:
from django.contrib import admin
from .models import Group
admin.site.register(Group)
New contributor
amirali mirzaei zadeh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.