Re: How are default values for fields used

2006-01-13 Thread akaihola
Jeff's right, I want to edit all fields in the full edit form, and use the defaults only in a quick add form. I generalized the code I showed above to a fill_missing_fields function. Now the only remaining problem I see is that it has to be called before validation and html2python. It would be ne

Re: How are default values for fields used

2006-01-13 Thread Jeffrey E. Forcier
On Jan 13, 2006, at 5:11 AM, Maniac wrote: You also can make a default manipulator not complain about those fields being absent on validation. Give them "editable=False" in the model. Then manipulator will omit them. Assuming this is still the same issue aikihola brought up on IRC yeste

Re: How are default values for fields used

2006-01-13 Thread Maniac
akaihola wrote: Actually, the manipulator doesn't even know about the default values of the model. Why that? If you just create AddManipulator and get its flatten_data you'll get default values of the model. Your example is based on hidden fields with default values. However, I've unders

Re: How are default values for fields used

2006-01-13 Thread akaihola
Maniac wrote: >What happens is that a manipulator checks the values that come from the web, >and not the default ones inside it. Actually, the manipulator doesn't even know about the default values of the model. Your example is based on hidden fields with default values. However, I've understoo

Re: How are default values for fields used

2006-01-12 Thread Maniac
akaihola wrote: Ok, I'll take a look at the _pre_save() mechanism. By the way, isn't that one of the things changing in magic-removal branch? Yes, it goes away. Instead one would be able to override save() and do everything in it. I still wonder about the default values question though.

Re: How are default values for fields used

2006-01-12 Thread akaihola
It seems that _pre_save() is never called if the manipulator catches missing fields. So customizing the manipulator seems to be my quick fix after all. I also checked the manipulator objects' attributes, and default values defined in models don't even end up there. So it might require quite a few

Re: How are default values for fields used

2006-01-12 Thread akaihola
Ok, I'll take a look at the _pre_save() mechanism. By the way, isn't that one of the things changing in magic-removal branch? I still wonder about the default values question though. I tried to create a Django object in an interactive Python shell, and the fields are indeed filled with default

Re: How are default values for fields used

2006-01-12 Thread Maniac
akaihola wrote: So, if I'm not mistaken, the default values for a model's fields are not used when saving an object, They are used to prefill form elements in the Admin (don't know about custom forms though, never tried). So it's just a hint for the user. and I must create a custom manipul

How are default values for fields used

2006-01-12 Thread akaihola
In the admin interface, I can't omit fields from "admin = meta.Admin(fields=...)" even if they do have default values. If I do that, I get errors for required fields. In my own forms, I first assumed I could just leave out fields with default values in the model, but my form.error_dict gets fille