mirror of
https://github.com/django/django.git
synced 2025-11-24 21:00:12 +00:00
Refs #28999 -- Added tests for reversing a class-based view by instance.
This commit is contained in:
parent
35ab2e0182
commit
be138f32ed
3 changed files with 20 additions and 1 deletions
|
|
@ -3,7 +3,7 @@ from functools import partial, update_wrapper
|
|||
from django.contrib.auth.decorators import user_passes_test
|
||||
from django.http import HttpResponse
|
||||
from django.urls import reverse_lazy
|
||||
from django.views.generic import RedirectView
|
||||
from django.views.generic import RedirectView, View
|
||||
|
||||
|
||||
def empty_view(request, *args, **kwargs):
|
||||
|
|
@ -58,6 +58,13 @@ def bad_view(request, *args, **kwargs):
|
|||
raise ValueError("I don't think I'm getting good value for this view")
|
||||
|
||||
|
||||
class _HelloView(View):
|
||||
def get(self, request, *args, **kwargs):
|
||||
return HttpResponse(f"Hello {self.kwargs['name']}")
|
||||
|
||||
|
||||
view_func_from_cbv = _HelloView.as_view()
|
||||
|
||||
empty_view_partial = partial(empty_view, template_name="template.html")
|
||||
empty_view_nested_partial = partial(
|
||||
empty_view_partial, template_name="nested_partial.html"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue