On Thu, 2007-06-14 at 00:12 +0000, Paul wrote:
> Is this possible? The old forms module allowed you to render the date
> and time separately in the template for the form. Now it seems this
> is no longer possible. So it isn't possible for instance to render
> the date on one row of a table and the time on the following row just
> below it like:
> <tr><td>{{form.blah}}</td><td>{{form.mydate.date}}</td></tr>
> <tr><td>{{form.blah2}}</td><td>{{form.mydate.time}}</td></tr>
It's not possible with the default SplitDateTime widget, but it would be
easy enough to subclass it to provide the functionality you want.
Newforms are designed around encouraging people to subclass things as
they need to add new features, rather than trying to provide everything
by default (which becomes too difficult to use in the common cases).
Create a SplitDateTimeWidget subclass and add date() and time() methods
that return the respective widgets (would replicate some of the logic in
MultiWidget.render)
Or your could write a patch for MultiWidget that allowed access to the
n-th widget in the sequence and post that to Trac. I can't think of
another generic method on MultiWidget that would help, since it's meant
to be able to handle an arbitrary number of contained values, not just
the date+time case.
Regards,
Malcolm
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---