Hi,

when displaying a form for a new object, I'm trying to set a default
value for a date field using a filter in a template, like so:

<form action="." method="post">
{{ form.somefield|date:"Y-m-d" }}

This gives me an error:
'FormFieldWrapper' object has no attribute 'year'.
What am I doing wrong (I'm using generic views)?

The other solution for providing default values, that unfortunately
doesn't work either, is to set these in the view, when the request is
GET (again, generic views):
def limited_create_object(*args, **kwargs):
  #...
  if request.POST:
    #
  else:
    new_data = request.GET.copy()
    new_data[ 'somefield' ] = str( ...)
    request._get = new_data
  return create_object( *args, **kwargs)

The problem with this approach lies in create_update.py, line 56:
new_data = manipulator.flatten_data()

i.e. the data gets overwritten.

What am I missing? Any help would be greatly appreciated.

Regards,
Andres

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

Reply via email to