#21898: SingleObjectMixin should not require slug or pk if queryset is given
-------------------------------------+-------------------------------------
     Reporter:  tomc                 |                    Owner:  nobody
         Type:                       |                   Status:  closed
  Cleanup/optimization               |                  Version:  master
    Component:  Generic views        |               Resolution:
     Severity:  Normal               |  worksforme
     Keywords:                       |             Triage Stage:
    Has patch:  0                    |  Unreviewed
  Needs tests:  0                    |      Needs documentation:  0
Easy pickings:  0                    |  Patch needs improvement:  0
                                     |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by mjtamlyn):

 * status:  new => closed
 * needs_better_patch:   => 0
 * resolution:   => worksforme
 * needs_tests:   => 0
 * needs_docs:   => 0


Comment:

 I'm going to close this ticket, despite the fact I agree the API could be
 better. That said for your specific use case there are two reasonable
 options with the current API:

 Firstly you can specify `slug_url_kwarg = 'url` and `slug_field = 'url'`
 and you will actually get the code you want without overriding any
 methods. There are some more complex use cases where this works, but I
 think in those situations it might be best to just override
 `get_queryset`.

 There's an argument that we should provide a better set of tools than
 `slug_url_kwarg`/`pk_url_kwarg` etc for customising `SingleObjectMixin`,
 but that would be a separate ticket.

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.e9b4558d9cfc1c7e338fafb1a182ac8e%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to