Opened 14 months ago

Closed 14 months ago

Last modified 14 months ago

#22113 closed Cleanup/optimization (fixed)

Improving clarity of what object_name means in get_template_names() or SingleObjectTemplateResponseMixin

Reported by: nikunj.sg@… Owned by: kobuz
Component: Documentation Version: 1.6
Severity: Normal Keywords: nlsprint14
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: yes UI/UX: no

Description

In the third bullet of https://docs.djangoproject.com/en/dev/ref/class-based-views/mixins-single-object/#django.views.generic.detail.SingleObjectTemplateResponseMixin.get_template_names, it would be clearer if you changed object_name to object_model name or model_name since objects do not have names

Change History (6)

comment:1 Changed 14 months ago by bmispelon

  • Easy pickings set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Hi,

I agree, model_name would probably be a better name (this is the actual name of the attribute that the code uses).
For completeness' sake, you should probably also alter the docstring of django.views.generic.base.SingleObjectTemplateResponseMixin.get_template_names.

There's also a mention of object_name in the documentation for MultipleObjectMixin [1] which should be changed.

Thanks.

[1] https://docs.djangoproject.com/en/dev/ref/class-based-views/mixins-multiple-object/#django.views.generic.list.MultipleObjectMixin.get_context_object_name

comment:2 Changed 14 months ago by kobuz

  • Keywords nlsprint14 added
  • Owner changed from nobody to kobuz
  • Status changed from new to assigned

comment:4 Changed 14 months ago by bmispelon

  • Patch needs improvement set

There's still some mentions of model_name in the docs.

The following command will show you where:

git grep -E "[^_]object_name" docs/

comment:5 Changed 14 months ago by Baptiste Mispelon <bmispelon@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In b8874084868080baff29ac3453d20a845fd1568c:

Fixed #22113 -- changed object_name to model_name in CBV docs.

Thanks to trac user nikunj.sg for the report.

comment:6 Changed 14 months ago by Baptiste Mispelon <bmispelon@…>

In 79cc1fa58df17c3d9335a07086111bad8caa2d88:

[1.6.x] Fixed #22113 -- changed object_name to model_name in CBV docs.

Thanks to trac user nikunj.sg for the report.

Backport of b8874084868080baff29ac3453d20a845fd1568c from master.

Note: See TracTickets for help on using tickets.
Back to Top