[Django] #22724: Improve SingleObjectMixin

12 views
Skip to first unread message

Django

unread,
May 29, 2014, 4:33:32 AM5/29/14
to django-...@googlegroups.com
#22724: Improve SingleObjectMixin
--------------------------------------+--------------------
Reporter: tomc | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Generic views | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+--------------------
Belatedly following on from https://code.djangoproject.com/ticket/21898

I feel that {{{slug_url_kwarg}}} and {{{pk_url_kwarg}}} don't feel very in
keeping with the rest of django to me, and some thought could be put into
improving this part of the API.

My personal opinion is that I don't think that SingleObjectMixin should
require a pk, slug, or these variables to be set if you provide a queryset
of your own. I don't see any reason why we shouldn't have a
{{{DetailView}}} without any arguments in the URL at all, if we provide a
single object in some manner. At the moment to do this, we have to
override {{{get_object()}}} and essentially rewrite it, which does not
feel very elegant to me.

--
Ticket URL: <https://code.djangoproject.com/ticket/22724>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 6, 2014, 9:42:57 AM6/6/14
to django-...@googlegroups.com
#22724: Improve SingleObjectMixin
-------------------------------------+-------------------------------------
Reporter: tomc | Owner: nobody
Type: | Status: new
Cleanup/optimization | Version: master
Component: Generic views | Resolution:
Severity: Normal | Triage Stage:
Keywords: | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by maxocub):

* cc: maxime.turcotte@… (added)
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/22724#comment:1>

Django

unread,
Jun 6, 2014, 11:23:48 AM6/6/14
to django-...@googlegroups.com
#22724: Improve SingleObjectMixin
--------------------------------------+------------------------------------

Reporter: tomc | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by aaugustin):

* stage: Unreviewed => Accepted


Comment:

Accepting per mjtamlyn's comment on #21898.

--
Ticket URL: <https://code.djangoproject.com/ticket/22724#comment:2>

Django

unread,
Jun 29, 2014, 3:22:45 PM6/29/14
to django-...@googlegroups.com
#22724: Improve SingleObjectMixin
--------------------------------------+------------------------------------
Reporter: tomc | Owner: msoedov
Type: Cleanup/optimization | Status: assigned

Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by msoedov):

* owner: nobody => msoedov
* status: new => assigned
* has_patch: 0 => 1


Comment:

Created pull request:

https://github.com/django/django/pull/2863

--
Ticket URL: <https://code.djangoproject.com/ticket/22724#comment:3>

Django

unread,
Jun 30, 2014, 8:19:43 AM6/30/14
to django-...@googlegroups.com
#22724: Improve SingleObjectMixin
--------------------------------------+------------------------------------
Reporter: tomc | Owner: msoedov
Type: Cleanup/optimization | Status: assigned
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timo):

* needs_docs: 0 => 1
* needs_tests: 0 => 1


Comment:

Needs tests and (probably) documentation.

--
Ticket URL: <https://code.djangoproject.com/ticket/22724#comment:4>

Django

unread,
Jul 11, 2014, 11:45:49 AM7/11/14
to django-...@googlegroups.com
#22724: Improve SingleObjectMixin
--------------------------------------+------------------------------------
Reporter: tomc | Owner: msoedov
Type: Cleanup/optimization | Status: assigned
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by dbrgn):

Tests have been provided by msoedov.

https://github.com/django/django/pull/2863

I'm unsure if there's any documentation that needs to be updated...
Couldn't find any at a first quick glance, but I could have missed
something.

--
Ticket URL: <https://code.djangoproject.com/ticket/22724#comment:5>

Django

unread,
Jul 11, 2014, 11:46:12 AM7/11/14
to django-...@googlegroups.com
#22724: Improve SingleObjectMixin
--------------------------------------+------------------------------------
Reporter: tomc | Owner: msoedov
Type: Cleanup/optimization | Status: assigned
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by dbrgn):

* needs_tests: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/22724#comment:6>

Django

unread,
Jul 11, 2014, 1:16:25 PM7/11/14
to django-...@googlegroups.com
#22724: Improve SingleObjectMixin
--------------------------------------+------------------------------------
Reporter: tomc | Owner: msoedov
Type: Cleanup/optimization | Status: assigned
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by timo):

The documentation to be updated is located
[https://docs.djangoproject.com/en/dev/ref/class-based-views/mixins-
single-object/ here]. Be sure to annotate the changes with `..
versionchanged:: 1.8` and also mention it in the release notes. It would
also be helpful to describe this better than "Improve SingleObjectMixin."
in the ticket & commit message.

--
Ticket URL: <https://code.djangoproject.com/ticket/22724#comment:7>

Django

unread,
Nov 10, 2014, 3:39:54 PM11/10/14
to django-...@googlegroups.com
#22724: Improve SingleObjectMixin
--------------------------------------+------------------------------------
Reporter: tomc | Owner: msoedov
Type: Cleanup/optimization | Status: assigned
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by mjtamlyn):

Proposed patch was significantly backwards incompatible (see my comments
on the PR). It however should be possible to refactor `get_object` itself
to make a better subclassing experience, possibly by adding an inner
`get_from_queryset` method, or by changing the behaviour when no slug or
pk is provided.

--
Ticket URL: <https://code.djangoproject.com/ticket/22724#comment:8>

Django

unread,
Nov 10, 2014, 3:54:52 PM11/10/14
to django-...@googlegroups.com
#22724: Improve SingleObjectMixin
--------------------------------------+------------------------------------
Reporter: tomc | Owner: msoedov
Type: Cleanup/optimization | Status: assigned
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by maxocub):

* cc: maxime.turcotte@… (removed)


--
Ticket URL: <https://code.djangoproject.com/ticket/22724#comment:9>

Django

unread,
Sep 15, 2020, 5:51:59 AM9/15/20
to django-...@googlegroups.com
#22724: Improve SingleObjectMixin
--------------------------------------+------------------------------------
Reporter: tomc | Owner: (none)

Type: Cleanup/optimization | Status: new
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by felixxm):

* owner: Alex Myasoedov => (none)
* status: assigned => new


--
Ticket URL: <https://code.djangoproject.com/ticket/22724#comment:10>

Reply all
Reply to author
Forward
0 new messages