ccollins/milkman — pull request #14 by Fandekasp (2011-12-23 17:11:04+00:00)
Title: Update milkman/dairy.py

When using the django-polymorphic app via django-shop, I end up with my product, let's say a Video, that inherits from Product.

When I try to milkman.deliver(Video), I get the error: "can't set attribute" (would be nice to get more info about that attribute that couldn't be set btw).
Trying with milkman.deliver(Video, product=product_previously_delivered) or with milkman.deliver(Video, product_ptr=product) doesn't help.

That is explained because :
- the field doesn't exists when it's trying to set the value in explicit_values, therefore setattr fails.
- the field already exists in read-only for set_local_fields, so setattr fails as well.

That's why I came with those solution:
- for set_local_fields, insure that the field doesn't already exist
- for the explicit value, if setattr fail, hardcode the field with target.k

If you have any issues with those solutions, thanks for explaining the reasons and offering a better solution to solve that problem, thanks in advance !