From the course: Django Essential Training
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Solution: Mark a note as public or private
From the course: Django Essential Training
Solution: Mark a note as public or private
(upbeat music) - [Instructor] We can start by adding a new field called public and we can make it a BooleanField saying that default is false, making every note private by default. Okay, that sounds good enough, but there's one more thing we can improve. Although public may sound good enough for now, it can get confusing when reading the code later on. What does public even mean? Is it saying if a note is public or when the note was made public or who made the change to make the note public? Whenever we're creating a new field or a new variable, it is important to think, how can I make the best with the littlest information possible? If I simply change this field from public to is public. There's only one answer here. The answer to this field must be a yes or no. The same way that if we change it to public ad, it would imply that we're talking about time. Always keep in mind that the easiest we make our code, the better we are at maintaining and improving it. Okay, so we have a…