Class views in Django

前端 未结 9 1804
一生所求
一生所求 2020-12-05 06:15

Django view points to a function, which can be a problem if you want to change only a bit of functionality. Yes, I could have million keyword arguments and even more if stat

9条回答
  •  既然无缘
    2020-12-05 06:52

    Sounds to me like you're trying to combine things that shouldn't be combined. If you need to do different processing in your view depending on if it's a User or Group object you're trying to look at then you should use two different view functions.

    On the other hand there can be common idioms you'd want to extract out of your object_detail type views... perhaps you could use a decorator or just helper functions?

    -Dan

提交回复
热议问题