PacktPublishing / Django-3-by-Example

Django 3 by Example (3rd Edition) published by Packt
https://djangobyexample.com/
MIT License
715 stars 690 forks source link

Chapter 1: AttributeError: Manager isn’t accessible via <<models>> instances #112

Open Dcolonel6 opened 2 years ago

Dcolonel6 commented 2 years ago

change published to something like pulished_post or objects_published because published attribute is conflicting with one the status choices.

class Post(models.Model): objects = models.Manager() published = PublishedManager() drafted = DraftedManager() STATUS_CHOICES = ( ('draft', 'Draft'), ('published', 'Published'), ) title = models.CharField(max_length=250) slug = models.CharField(max_length=250, unique_for_date='publish') body = models.TextField()