python - Django FieldError and AttributeError exceptions after adding new field to model -


i'm writing multipurpose web application, , data model in flux.

i have class client defined as

class client(models.model):     client = models.integerfield(primary_key=true, db_column = "client_id")     client_name = models.charfield(max_length=100l, unique = true)     parentorg = models.foreignkey("parentorgs")     demo_client = models.integerfield()     live_client = models.integerfield(db_column = "live_client")      class meta:         db_table = 'txn_client' 

the last field, live_client, has been added. fliter field differentiate between active , inactive client objects. rather relying on data migration, did alter table statement in mysql add field , set 1 relevant records. has worked in past 0 issues.

in view method, have

from app.models import client  def index(request):     client_list = client.objects.filter(live_client = 1) 

suddenly, throwing fielderror, because django cannot resolve keyword 'live_client' field, , displays alternative keywords.

to make sure model record replicating database table, ran

python manage.py inspectdb 

and client class in models.py replicated inspectdb printout.

for further testing, changed index method

def index(request): client_list = client.objects.all()  c in client_list:     print c.live_client 

this in turn threw attributeerror stating 'client' object has no attribute 'live_client'

now, contradicting defined in both models.py , printout python manage.py inspectdb


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -