开发者

what's better to have a view for create and one for edit or one for both?

开发者 https://www.devze.com 2022-12-12 06:11 出处:网络
what\'s better to have a view for create and on开发者_Python百科e for edit or one for both ?That might depend on your situation. If the create form is significantly different from teh edit form then t

what's better to have a view for create and on开发者_Python百科e for edit or one for both ?


That might depend on your situation. If the create form is significantly different from teh edit form then two views, otherwise one view.

Sometimes you find that create requires either fewer or more fields depending on whether the user is allowed to edit all fields or not. Sometimes it leads to a lot of extra logic to switch the fields off. In those cases, two views is simpler to maintain.


From my experiense it is better to have separate views for creating and for editing. In such way you will get more straightforward logic and more maintainable code even if with little doubling


Depends on who's creating and who's editing.

You may not want to have people who can create something be able to modify each individual field, but someone who edits would need to be able to modify most, or all, fields.

It can make the view cleaner to the users if they don't have to look at everything for both creating and editing.

0

精彩评论

暂无评论...
验证码 换一张
取 消