On Sat, 2008-06-28 at 06:12 -0700, ionut wrote:
> I do'nt consider to be a MVC good pattern rendering form html inside
> newforms class.

A form class is purely presentational, so there's no "MVC" (or whatever
you might want to call it -- you can't do MVC on the web, after all)
violation going on in that respect.

> I think a better proach while rendering html forms is to use a
> template file

[...]

So do that. There's nothing stopping you from implementing whatever
method you like on forms. I've done similar things for some of my forms,
reading the presentation layout from a template for rendering. It's not
necessarily a universal solution, since it requires quite a lot of logic
in the template to handle all cases and can consequently get very messy,
so sometimes the trade-off of placing HTML in the Python code leads to
something that's easier to manage. Sometimes, though, your approach is
easiest (it does keep the HTML and the Python separate, for example).

Remember, a form is just a class on which you call methods in your
template. So implement the presentation method you call however you
like.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to