If you can't use _html_output, then you have to duplicate a lot of
it's functionality.

That's a lot internals, and you would have to track any changes with
revisions.  Of
course, _html_output is, itself, an internal, according to the naming
conventions.

If what you're wanting to do is change the rendering order, not that your form's
self.fields (for model forms, anyway) is a deep copy of the form field set, plus
any explicit form fields that you added, in an ordered dict.  Since
you're not sharing
that dict, you can change the keyOrder list.  (You can probably even elide fieds
this way.)  The superclass __init__() has to have run, since it's what does the
deepcopy, but you can monkey in your __init__() after calling the
superclass method.
Strictly speaking, that's monkeying with internals too, but I know of
no other way to
have different render orders for different model forms on the same
model (I make it
match the fields set from the Meta class in my application).

Bill

On Thu, Jun 3, 2010 at 11:05 AM, Thomas Allen <[email protected]> wrote:
> How can I create my own form renderer, like as_p, as_table, etc? I see
> that the form class provides _html_output to assist in formatting
> markup like this, but that substitution technique does not provide
> enough control for what I am doing, where certain properties of the
> field in question affect the ordering of elements and not just the
> value of element attributes or content.
>
> I am tempted to write a template tag that renders a form to my
> standards, but unfortunately _html_output handles a lot more than just
> formatting a template string, so I think that I would have to maintain
> a copy of a good bit of _html_output's logic in such a template tag.
>
> Thomas
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" 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-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" 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-users?hl=en.

Reply via email to