Django Book 翻译
菜单>:
TOC
返回
原文:
If youre familiar with other MVC Web-development frameworks, such as Ruby on Rails, you may consider Django views to be the controllers and Django templates to be the views. This is an unfortunate confusion brought about by differing interpretations of MVC. In Djangos interpretation of MVC, the view describes the data that gets presented to the user; its not necessarily just *how* the data looks, but *which* data is presented. In contrast, Ruby on Rails and similar frameworks suggest that the controllers job includes deciding which data gets presented to the user, whereas the view is strictly *how* the data looks, not *which* data is presented.
翻译:
如果你熟悉其它的 MVC Web开发框架,比方说 Ruby on Rails,你可能会认为 Django 视图是控制器,而 Django 模板是视图。很不幸,这是对 MVC 不同诠释所引起的错误认识。在 Django 对 MVC 的诠释中,视图用来描述要展现给用户的数据;不是数据看起来 *怎么样* ,而是要呈现 *哪些* 数据。相比之下,Ruby on Rails 及一些同类框架提倡控制器负责决定向用户展现哪些数据,而视图则仅决定 *如何* 展现数据,而不是展现 *哪些* 数据。
备注:
译者: