#30030: SingleObjectMixin raises misleading AttributeError when called witout pk or slug -----------------------------------------+-------------------------- Reporter: oliver | Owner: oliver Type: Bug | Status: assigned Component: Generic views | Version: master Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 0 Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | -----------------------------------------+-------------------------- {{{ class FooUpdateView(django.views.generic.UpdateView): model = Foo form_class = FooForm template_name = 'foo.html' }}} {{{ urlpatterns = [ url(^'foo/$', FooUpdateView,as_view(), name='detal'), ] }}}
In above code, If a user calls `foo/`, following AttributeError will be raised. `Generic detail view FooUpdateView must be called with either an object pk or a slug in the URLconf.` FooUpdateView raises the error even though it isn't generic detail view. Also CreateView has this issue because it inherits from SingleObjectMixin. -- Ticket URL: <https://code.djangoproject.com/ticket/30030> 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 django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/053.16671e6e85dd44e31a557bc1eed77fc4%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.