Skip to content
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

Fix DJ008 Model does not define __str__ method #1767

Merged
merged 1 commit into from
Dec 1, 2023
Merged

Conversation

brianhelba
Copy link
Collaborator

No description provided.

@brianhelba
Copy link
Collaborator Author

I'm not sure if any of these are ideal string representations, so feedback is welcome.

Copy link
Member

@mvandenburgh mvandenburgh left a comment

Choose a reason for hiding this comment

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

These all seem logical to me.

@waxlamp
Copy link
Member

waxlamp commented Dec 1, 2023

Out of curiosity, why is this considered an error? More specifically, when are these models coerced to strings generally -- in a Python shell?

@brianhelba
Copy link
Collaborator Author

@waxlamp The Django Admin pages use it in a number of places, particularly when showing a foreign key reference to another object.

See: https://docs.astral.sh/ruff/rules/django-model-without-dunder-str/#why-is-this-bad

@brianhelba brianhelba merged commit 77f6e7c into master Dec 1, 2023
10 checks passed
@brianhelba brianhelba deleted the str-model branch December 1, 2023 18:36
@dandibot
Copy link
Member

🚀 PR was released in v0.3.67 🚀

@dandibot dandibot added the released This issue/pull request has been released. label Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants