After settings up my models, I realized I needed a way to access the fields of my custom model without rewriting Satchmo's views. To do this, I wrote a custom template tag that takes an instance of the Product model and spits out the relevant fields of the custom model. Posted in the hope that perhaps it'll help somebody who's going through the same headaches as me. What I've found myself really liking about Satchmo is that it forces a better understanding of Django, and a lot of its features I'd never explored before.
On Mar 23, 3:09 pm, davis <[email protected]> wrote: > That would be great, Bob! > > Before I went the documented Custom Product route, I wished I could've > just sub-classed Product, but I figured it wasn't possible, so I > didn't bother trying. The one-to-one method is working, but it's much > more complicated than I'd like it to be. > > Looking forward to your write-ups. > > On Mar 23, 12:46 pm, Bob Waycott <[email protected]> wrote: > > > No problem. I hope to set aside some time this week to complete a couple of > > write-ups regarding subclassing Satchmo models and grafting custom behaviors > > on to the shop via signals. > > I'll try and post a note to the list if/when I get them done. > > > On Thu, Mar 19, 2009 at 6:44 PM, Bob Waycott <[email protected]> wrote: > > > I can only speak from my experience of having a very similar need. > > > Rather than go the route suggested by custom product modules and having > > > the > > > one-to-one headache, I subclass Satchmo's Product model, thus ensuring a > > > Satchmo product is added/updated with each add/update in my custom model > > > via > > > model inheritance. It works wonderfully thus far. > > > > Bob > > > > On Thu, Mar 19, 2009 at 4:49 PM, Udbhav <[email protected]> wrote: > > > >> This is mostly a general question. I'm just looking for some > > >> guidelines on the best way of accomplishing my particular task. > > > >> I have an existing Django project, with a pretty large database. This > > >> single project also runs 7 different sites. Most of the content is > > >> shared across the sites with slight differences in templating etc. > > >> I've used Django's sites framework along with a Many-To-Many > > >> relationship to the Site object in the bulk of my models, thus > > >> allowing the site admins to choose what content shows up where. > > >> Anyway, I was planning on using Satchmo's multiple store option to set > > >> up 7 different stores, but I was hoping to find a relatively easy way > > >> to incorporate all the pre-existing content into Satchmo. The > > >> majority of the models I've defined are now going to be products that > > >> are sold through Satchmo. > > > >> My first impulse was to attach a particular model to Satchmo using the > > >> Custom Product Module, which I managed to do successfully. For now, > > >> let's call my model Paint. Now, as there is a One-To-One relationship > > >> between Paint and Satchmo's Product model, all my existing Paint > > >> objects don't show in the admin until I assign them a product id that > > >> corresponds to an existing Product. This is kind of painful, and > > >> requires that I manually change my MySql database, forcing me to do > > >> data entry...sigh. > > > >> My second idea was to export my existing Paint tables, reformat them > > >> to fit Satchmo's expectations, then import them as straight up Satchmo > > >> products, and possibly extend them with a custom product module > > >> later. The only drawback to this that I can foresee is that I'll be > > >> forced to rewrite my views and templates. > > > >> Which route would all of you experienced users suggest, or is there a > > >> third option I'm missing? > > > >> Thanks in advance for your time and patience! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Satchmo users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/satchmo-users?hl=en -~----------~----~----~----~------~----~------~--~---
