#34446 closed Bug (fixed)
Coding style docs should contain incorrect example for Model style.
Reported by: | JiriKr | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Joseph V Zammit, Paolo Melchiorre | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/coding-style/#model-style
In dev documentation version there is no difference between Do this: and Don’t do this: in Meta section.
class Person(models.Model): first_name = models.CharField(max_length=20) last_name = models.CharField(max_length=40) class Meta: verbose_name_plural = "people"
In 4.1 version it is correct. Related to https://code.djangoproject.com/ticket/34140 .
Change History (8)
follow-up: 4 comment:1 by , 21 months ago
Cc: | added |
---|---|
Easy pickings: | set |
Summary: | Code style - incorrect Model Style → Coding style docs should contain incorrect example for Model style. |
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 21 months ago
TBH, I think this example is no longer needed as we have black
CI builds. I'd remove it:
-
docs/internals/contributing/writing-code/coding-style.txt
diff --git a/docs/internals/contributing/writing-code/coding-style.txt b/docs/internals/contributing/writing-code/coding-style.txt index 5b64e94b24..812be79c91 100644
a b Model style 279 279 280 280 Don't do this:: 281 281 282 class Person(models.Model):283 first_name = models.CharField(max_length=20)284 last_name = models.CharField(max_length=40)285 286 class Meta:287 verbose_name_plural = "people"288 289 Don't do this, either::290 291 282 class Person(models.Model): 292 283 class Meta: 293 284 verbose_name_plural = "people"
comment:4 by , 21 months ago
Has patch: | set |
---|---|
Triage Stage: | Accepted → Ready for checkin |
Replying to Mariusz Felisiak:
JiriKr, Would you like to prepare a patch?
Yes, I would like to. It's my first contribution to Django (hope it will be correct).
Thank you for guidance, I prepared PR
comment:5 by , 21 months ago
Triage Stage: | Ready for checkin → Accepted |
---|
Sorry, not sure if I can change Triage Stage.
comment:6 by , 21 months ago
Triage Stage: | Accepted → Ready for checkin |
---|
Sorry, not sure if I can change Triage Stage.
You shouldn't change stage for your own tickets/PRs ;), but I can. Thanks!
Great catch! We should remove this blank line:
docs/internals/contributing/writing-code/coding-style.txt
I hope there is a way to skip
blacken-docs
on this example.JiriKr, Would you like to prepare a patch?