Skip to content

Lab 2.4: Code example has bugs #23

@tim-schilling

Description

@tim-schilling

Location

docs/lab2.md, Lab 2.4 Conclusion section (lines 473-474)

Issue

The example code has two bugs:

post = get_objects_or_404(...)
post.is_public != post.is_public
  1. get_objects_or_404 should be get_object_or_404 (singular "object")
  2. != is a comparison operator, not assignment. Should be = not to toggle the boolean

Suggested fix

post = get_object_or_404(...)
post.is_public = not post.is_public

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions