Re: [mezzanine-users] Custom Django app used to replace Cartridge models and functions

2014-09-14 Thread Andrew Walters
Thank you very much for your feedback .

The field injection looks very useful , if I still want to add custom 
functions would my only option be to subclass ?


On Friday, 12 September 2014 20:57:11 UTC+2, Kenneth Bolton wrote:

 Your instincts are good; copying and/or modifying the cartridge source 
 will cause major problems when you are ready to upgrade.

 Cartridge is just a Django app, so go ahead with custom apps. Custom apps 
 are particularly useful for storing your custom templates, user profiles, 
 and such.

 To modify the Product model, use Mezzanine's field injection 
 http://mezzanine.jupo.org/docs/model-customization.html#field-injection.

 hth,
 ken

 On Fri, Sep 12, 2014 at 2:40 PM, Andrew Walters abwal...@gmail.com 
 javascript: wrote:

 Hi , 

 I am trying to figure the cleanest and most efficient way of implementing 
 my own code alongside Cartridge . 
 Currently I want to add a few custom fields and functions to the 
 Cartridge Product model . Initially I copied the cartridge.shop folder over 
 to my project and edited the original definitions . However I imagine this 
 will cause problems later on with readability and any eventual updates.

 Ideally I'd like to create an additional app e.g. custom-code that 
 would have my own implementation of the Product model in it's models.py , 
 with the hope that I could somehow then have this Product class used 
 instead of the default Cartridge model.
 Does anyone know if something like this is possible ?

 I am loath to subclass the Product model , because if I understand 
 correctly I'd then have a second admin page for entering data for this 
 class .

 Any help will be much appreciated . I've used Python quite extensively 
 but other than a few tutorials I am relatively new to Django . 
 Alternatively I'd really appreciate anyone who can point me to an example 
 site with good practices for customizing Cartridge .

 Thanks 
 Andrew

 -- 
 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 mezzanine-use...@googlegroups.com javascript:.
 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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Custom Django app used to replace Cartridge models and functions

2014-09-14 Thread Ken Bolton
To add functions to existing classes, I monkey-patch.

k

On Sun, Sep 14, 2014 at 10:44 AM, Andrew Walters abwalter...@gmail.com
wrote:

 Thank you very much for your feedback .

 The field injection looks very useful , if I still want to add custom
 functions would my only option be to subclass ?


 On Friday, 12 September 2014 20:57:11 UTC+2, Kenneth Bolton wrote:

 Your instincts are good; copying and/or modifying the cartridge source
 will cause major problems when you are ready to upgrade.

 Cartridge is just a Django app, so go ahead with custom apps. Custom apps
 are particularly useful for storing your custom templates, user profiles,
 and such.

 To modify the Product model, use Mezzanine's field injection
 http://mezzanine.jupo.org/docs/model-customization.html#field-injection
 .

 hth,
 ken

 On Fri, Sep 12, 2014 at 2:40 PM, Andrew Walters abwal...@gmail.com
 wrote:

 Hi ,

 I am trying to figure the cleanest and most efficient way of
 implementing my own code alongside Cartridge .
 Currently I want to add a few custom fields and functions to the
 Cartridge Product model . Initially I copied the cartridge.shop folder over
 to my project and edited the original definitions . However I imagine this
 will cause problems later on with readability and any eventual updates.

 Ideally I'd like to create an additional app e.g. custom-code that
 would have my own implementation of the Product model in it's models.py ,
 with the hope that I could somehow then have this Product class used
 instead of the default Cartridge model.
 Does anyone know if something like this is possible ?

 I am loath to subclass the Product model , because if I understand
 correctly I'd then have a second admin page for entering data for this
 class .

 Any help will be much appreciated . I've used Python quite extensively
 but other than a few tutorials I am relatively new to Django .
 Alternatively I'd really appreciate anyone who can point me to an
 example site with good practices for customizing Cartridge .

 Thanks
 Andrew

 --
 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 mezzanine-use...@googlegroups.com.
 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 mezzanine-users+unsubscr...@googlegroups.com.
 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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Mezzanine.generic issues with South

2014-09-14 Thread Danny

On 15/09/2014 6:05 AM, Avery Laird wrote:

Hi,

I'm having an issue with migrating certain apps. The problem seems to be
well known, although I find myself unsure about how to fix it. I get the
following message when trying to migrate:

Your project contains migrations that include one of the fields
 from mezzanine.generic in its Migration.model dict: possibly
 KeywordsField, CommentsField or RatingField. These migratons no
 longer work with the latest versions of Django and South, so you'll
 need to fix them by hand. This is as simple as commenting out or
 deleting the field from the Migration.model dict.
 See http://bit.ly/1hecVsD for an example.

The unsynced apps are:
  - zeni_core
  - cartridge.shop
  - mezzanine.conf
  - mezzanine.core
  - mezzanine.generic
  - mezzanine.blog
  - mezzanine.forms
  - mezzanine.pages
  - mezzanine.galleries
  - mezzanine.twitter
  - mezzanine_events

 From what I understand, I must comment out all references
to KeywordsField, CommentsField or RatingField in the apps
Migration.model dictionary (all apps except for mezzanine ones).
However, after a cursory search through a single apps migration files, I
found multiple instances in just a single migration file, of which there
where about 25 files, and that's just a single app. Am I searching for
the wrong thing? Do I have to go through and make all those changes by
hand, or is there a way to streamline the process? Any help or insight
would be greatly appreciated!


I think this was to do with a Django upgrade.

Go through the files in your migrations folder and comment out the lines 
referencing keywords, comments or ratings. You should hopefully only 
have to do this in your custom app.


(I have a customised fork of cartridge and had to do it there, but you 
might be able to get away with only doing it in your app zeni_core)


Seeya. Danny.



Thanks,

Avery



--
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 mezzanine-users+unsubscr...@googlegroups.com
mailto:mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.




--
Email: molo...@gmail.com

--
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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.