PacktPublishing / Django-4-by-example

Django 4 by example (4th Edition) published by Packt
https://djangobyexample.com/
MIT License
799 stars 461 forks source link

Chapter 1 (page 18-19) / AttributeError: type object 'Post' has no attribute 'Status' #39

Open AVoca13 opened 1 year ago

AVoca13 commented 1 year ago

I kept getting this error when trying to access the 'Post' model from the Python shell.

from blog.models import Post Post.Status.choices Traceback (most recent call last): File "", line 1, in AttributeError: type object 'Post' has no attribute 'Status'

After several failed attempts, I decided to run the 'python manage.py make migrations blog' command on terminal and it worked. I don't understand why the book instructs you to run the 'makemigrations' command afterwards (as shown on page 21).

I'm just a newbie so I don't quite understand what I could have possibly done wrong as I followed the instructions to the dot and double checked everything a million times. Luckily, I tried some other tutorials and they were making migrations to make the model take effect.

I would appreciate any clarifications, thank you 😊