Hey Adrian --

In general, I think this is a pretty good idea.  However, I've got  
quite a bit of code the does something similar to the following:

        obj = SomeObject()
        for field in some_dict:
                setattr(obj, field, some_dict[field])
        obj.save()

i.e. build up on abject incrementally -- actual code usually does  
some operations in the loop, of course.  This is especially common in  
code that's parsing XML to produce an object.  Yes, I could save up  
the attributes in a dict and apply it later, but this approach feels  
right to me when I've used it.

Also, I can see this being very tricky in cases where validators are  
dependant on other fields.  Consider the following situation:

        class MyModel(models.Model):
                field1 = 
meta.CharField(validator_list=[RequiredIfOtherFieldNotGiven 
('field2')])
                field2 = 
meta.CharField(validator_list=[RequiredIfOtherFieldNotGiven 
('field1')])

        obj = MyModel(field1="whatever")        # Works since field2 is only 
required
                                                # if field1 is empty

        obj.field1 = ''                         # Fails - field1 is required
        obj.field2 = 'some_value'               # As a group, these two 
statements should  
work

Given this, I'm pretty sure that validation should be performed upon  
obj.save() -- and also possibly voluntarily without saving through a  
method like obj.validate().

I'm totally OK with silent up-conversion of (say) date values from  
strings to datetime objects -- as long as there's NEVER silent data  
loss.  So if an invalid format is passed in to a date field's  
__setattr__ an exception should be raised at that point.

I'm also OK with not exposing edit-inline for exactly the same  
reasons you are.

See you at pycon!

Jacob

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

Reply via email to