On Tue, May 10, 2016 at 11:54 AM, David Unric <[email protected]> wrote:
> I'd like replace field type for billing/shipping country, at > cartridge.shop.models.Order model. > Instead of plain CharField I'd like use CountryField from django_countries. > > Is that possible with Mezzanine and how ? > > settings.EXTRA_MODEL_FIELDS does not work, it throws an exception same > named field already exists. It sounds logical as it serves for *extending* > models, not replacing. > I can't also find a setting to specify alternate class for Order model so > it seems subclassing won't be an option. > > Any better idea then a fuzzy conversion to/from CountryField in custom > form ? > One workaround might be save whatever in the old fields (because those are required) and remove them from displaying (i.e. in the admin) while show the new field. Although a bit nasty, it might work :) I was working on customizing the order process and the way here - from what I found from other packages, don't know if it is the best - seems to be adding the fields you need to the model and the form, and removing the not-needed from the form, the view and other parts. For removing from the form, you have to hack on the __init__ of the Order form (which you can specify), you have to mark as not required and remove the widgets or provide a workaround. In the view, you may end monkey patching the order view - you copy the source code, modify it and then assign it, i.e. "show_views.checkout_steps = your_checkout_steps". (This is the most complicated part to me) This article shows examples of the techniques; http://bitofpixels.com/blog/collecting-additional-information-on-a-per-product-basis-in-cartridge/ For examples on modifying the Order form look at the payments packages, i.e.: https://github.com/explodes/cartridge-payments/blob/master/payments/multipayments/forms/base.py HTH, Rodrigo > -- > 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. > -- 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.
