On 12/27/06, Adrian Holovaty <[EMAIL PROTECTED]> wrote:
On 12/25/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > 2. Sometimes its very important for me to show some initial values in > form, on 'Add' screen. Typical > example, is a form, where customer can specify a different First,Last > Name and Email address. If > I pass data=xxx to form constructor, it will perform validation, and > since all other fields are empty, > this will bring a error. This is a good point -- I was going to suggest just passing the default values as data to the form, but that would indeed cause the other fields to be validated. Any ideas on a solution to this? We could add a "default" parameter to a Field, as has been discussed before, but something about that rubs me the wrong way.
there could be an initial_value parameter for Fields... I have implemented it as part of the default parameter, I am still waiting for any feedback, one of the solutions to that problem (see the post in this group [0]) would be to split the behaviour between initial_value -- something to display in a field when created and default -- something to replace empty value when submitted 0 -- http://groups-beta.google.com/group/django-developers/msg/82d8f4299afc2af0
> 3. Sometimes, its very important to specify field names. I was not able > to change it. For example, to save > using django own manipulator, I had to rename field before saving: > data['customizedaddress.0.subject'] = > data['subject_taught'] > For a different reasons, there must be a way to override and specify > own field name. May be I should try to pass it via attrs to widget? I'm not sure I understand your question here; are you saying you'd like to rename the fields used in a Form generated by form_for_model()? > 4. In documentation its said: "django.newforms is a new replacement for > django.forms, the old Django form/manipulator/validation framework.". > The question is, if it replaces manipulators, where is this part? Is > not developed yet? Because I've still used manupulators to save data. > Otherwise my code will grow 2-3 times by passing completely similar > arrays of model data for save/add/change. I've started the implementation for this -- it's the function django.newforms.form_for_model(). It's not finished yet, though. Adrian -- Adrian Holovaty holovaty.com | djangoproject.com >
-- Honza Kr l E-Mail: [EMAIL PROTECTED] ICQ#: 107471613 Phone: +420 606 678585 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers?hl=en -~----------~----~----~----~------~----~------~--~---