Class views in Django

前端 未结 9 1799
一生所求
一生所求 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 07:06

    Generic views will usually be the way to go, but ultimately you're free to handle URLs however you want. FormWizard does things in a class-based way, as do some apps for RESTful APIs.

    Basically with a URL you are given a bunch of variables and place to provide a callable, what callable you provide is completely up to you - the standard way is to provide a function - but ultimately Django puts no restrictions on what you do.

    I do agree that a few more examples of how to do this would be good, FormWizard is probably the place to start though.

提交回复
热议问题