> Without knowing exactly which models you're modifying, I would recommend 
> to avoid field injection in reusable apps. If you're injecting stuff on 
> Page, it might be better to create a custom Page type and distribute 
> that with your package. See: 
>
I extend models which are not designed as swappable as 
cartridge.shop.ProductVariation, ProductOption, CartItem, Orde or 
mezzanine.blog.BlogPost etc.
 

>  
>
If you still want to go with the field injection route, there are a few 
> approaches that I know of: 
>
> - Maintain your own migration history for modified models using Django's 
> MIGRATION_MODULES 
>
> http://mezzanine.readthedocs.io/en/latest/model-customization.html#field-injection-caveats
>  
>
> I'm aware of this option, but it is a dictionary with application name as 
a key, right ? How can I tell Django to look for *cartridge.shop* 
migrations both at original path and my extension package ?

- Add support for "out of app" migrations to Django 
> http://bitofpixels.com/blog/upgrading-to-mezzanine-4/ 
> <http://www.google.com/url?q=http%3A%2F%2Fbitofpixels.com%2Fblog%2Fupgrading-to-mezzanine-4%2F&sa=D&sntz=1&usg=AFQjCNFvw2p5DqSVoshgLZA_paUv6CsD5A>
>  
> (see the 
> EXTRA_MODEL_FIELDS section) 
>
> Tried trick django with "out of app" migrations by altering their app 
label in initializer, but getting cyclic errors for ForeignKey fields.
 

> - Create a model with your extra fields and couple it with a OneToOne 
> field. 
>
 Yes, but it would require big code refactoring, loss of logical 
separateness, less effectiveness as whole model loaded even when some parts 
won't be used ...

Anyway thanks for your reply.

I may come with specific migration error if there even exists some solution 
without monkeypatching Django itself.
 

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to