Skip to content

Corrected code examples in topics docs. #19697

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 11, 2025
Merged

Conversation

Rohit10jr
Copy link
Contributor

This PR corrects few minor issues in the Django topic guides:

  • Fixed incorrect use of request instead of self.request in the
    JsonableResponseMixin example.
  • Corrected import errors in code snippets.
  • Fixed small typos and inconsistencies across topic guides.

These changes improve the accuracy of the documentation examples, ensuring
They can be copied and run without errors.

@github-actions github-actions bot added the no ticket Based on PR title, no linked Trac ticket label Aug 2, 2025
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello! Thank you for your contribution 💪

As it's your first contribution be sure to check out the patch review checklist.

If you're fixing a ticket from Trac make sure to set the "Has patch" flag and include a link to this PR in the ticket!

If you have any design or process questions then you can ask in the Django forum.

Welcome aboard ⛵️!

Copy link
Contributor

@sarahboyce sarahboyce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the suggestions!
I have some minor comments

@@ -275,6 +275,7 @@ function decorator into a method decorator so that it can be used on an
instance method. For example::

from django.contrib.auth.decorators import login_required
from django.views.decorators.cache import never_cache
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
from django.views.decorators.cache import never_cache

I would drop this, it's not needed for the initial example and for the example
We could add it to the example lower down but I think the concept it is showing is clear enough without the import

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that the concept is clear, but adding the import could help beginners avoid confusion when copy-pasting the example. Thanks for the suggestions, I've made the other corrections you suggested, happy to leave the import out if you prefer.

@sarahboyce sarahboyce changed the title Fix minor errors in topic guide examples Corrected code examples in topics docs. Aug 11, 2025
Copy link
Contributor

@sarahboyce sarahboyce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you ⭐

@sarahboyce sarahboyce merged commit fa804d0 into django:main Aug 11, 2025
11 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no ticket Based on PR title, no linked Trac ticket
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants