我有一个自定义的基于类的视图
# myapp/views.py
from django.views.generic import *
class MyView(DetailView):
template_name = 'detail.html'
model = MyModel
def get_object(self, queryset=None):
return queryset.get(slug=self.slug)
我想像这样传入slug参数(或视图的其他参数
MyView.as_view(slug='hello_world')
我需要重写任何方法才能做到这一点吗?