Hi all (and especially Adrian),

I appreciate that everyone is very busy with OSCON travel and other
work commitments, but I've got a few big tickets that have queued up
over the last month or so waiting on comments and/or BDFL blessing for
checkin. If at all possible, I'd appreciate some eyeball love (or an
indication of the sort of timeframe in which eyeballs might be
available).

I've included summaries below, but the short version is:

#3297 - FileField/ImageField for newforms
http://code.djangoproject.com/ticket/3297

#4001 - saving m2m fields on newforms with commit=False
http://code.djangoproject.com/ticket/4001

#4418 - Newforms media
http://code.djangoproject.com/ticket/4418

These changes all require documentation - I'm happy to write the first
draft once the designs are blessed.


#3297 - FileField/ImageField for newforms
~~~~~~~~~~~~~~~~~~~~
Patch: filefield-5779.diff

This reintroduces File and Image field upload handling to newforms. A
forms.FileField and forms.ImageField is provided, with some
modifications to models.FileField, models.ImageField and
form_for_model/instance to support the new fields.

 * Modifies Form to take a "files" argument, for storage of file data.
This means you no longer have to copy and update your POST dictionary
when you submit a form' - you just call MyForm(request.POST,
request.FILES)

 * Introduces an "UploadedFile" temporary object to store the
submitted file data.

 * Modifies the internals of the form_for_model/instance save method
to make field saving more generic, rather than making a special case
of FileField?. This should make writing custom fields with unusual
save requirements much easier.

This patch introduces 2 potential backwards incompatibilities:

 * If you are relying upon auto_id being the 2nd argument on a form
(rather than explicitly naming auto_id=False), your rendered forms
will start adding <label> tags.

 * If you have written any custom code using value_from_datadict, you
will need to modify those implementations to handle the new files
argument.


#4001 - saving m2m fields on newforms with commit=False
~~~~~~~~~~~~~~~~~~~~
Patch: 4001.diff

If you have a form_for_model form for a model that has m2m data, you
can't use save with commit=False as the m2m data will be lost. The
code currently contains a GOTCHA describing this issue.

The patch on #4001 removes the gotcha by dynamically adding a
save_m2m() method to the form if commit=False. This means the user can
call:

>>> instance = f.save(commit=False)
>>> ... perform other changes ...
>>> instance.save()
>>> f.save_m2m() # can save now that instance exists

and the m2m data is not lost.


#4418 - Newforms media
~~~~~~~~~~~~~~~~~~~~
Patch: newforms-admin-media.5651.diff

Using this patch, Widgets, Forms, and newforms-admin ModelAdmin
definitions can add a Media definition. A media definition can be as a
DSL class, or a property; there are rules for inheritance of media
from subclasses, and ways to prevent the inheritance. Media for a form
is the union of all media required by all widgets.

The patch has been prepared against newforms-admin - I believe the
suggestion was to push this into newforms-admin branch so that it
could get a workout before it became stable trunk API.

The one significant change to existing structures is that the js
setting on ModelAdmin (which was a copy of the old js setting in the
Admin class) has been replaced with a media declaration. This isn't
really backwards incompatible, but its worth mentioning.

Jacob has been enthusiastic about this patch; Malcolm has also weighed
in with comments that have been factored into the design.

Thanks,
Russ %-)

--~--~---------~--~----~------------~-------~--~----~
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