Answer the question
In order to leave comments, you need to log in
How does django detect letter case?
There is such code:
And here are the lines in it:
class Post(models.Model):
STATUS_CHOICES = (
('draft','Draft'),
('published','Published')
)
Answer the question
In order to leave comments, you need to log in
Because in that select from ('draft','Draft'), 0 is taken as value and 1 as a label.
Similarly, post.status will always be a 0 element, and post.get_status_display() must be called to access the signature
https://docs.djangoproject.com/en/2.2/ref/models/i...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question