Bob, Thanks for your reply. I want to use model inheritance for the very reason you mentioned, but I'm concerned it will become difficult to manage in the long run. It is likely that there will be thousands of products on the site, and thousands more that will never be activated. What should happen to submissions that are never activated? Is it important to keep a history of a user's submissions, or should I just delete the ones that are rejected? I realize that this is ultimately a design decision I will have to make, but I would like to know how other people would approach this.
Thanks for letting me bounce my ideas and questions off you! On Oct 9, 5:54 am, Bob Waycott <[email protected]> wrote: > Is there a reason you couldn't save yourself the duplicated data by > inheriting Product, but setting is_active=False until the time that all > requirements are met and it actually becomes a live downloadable product? > > > > On Fri, Oct 9, 2009 at 4:09 AM, Godshall <[email protected]> wrote: > > > I'm developing a store that will offer user contributed downloadable > > products. I'm still very early in the process, but I have satchmo > > installed properly and I'm working through the source code and > > documentation to figure out the best approach for this kind of service > > (without hacking the satchmo source hopefully). > > > Here is a general overview of how I envision this working: > > 1. User submits content for review (needs to support multiple file > > uploads). > > 2. Admin reviews the submission and either approves, rejects, or > > instructs the user what steps need to be taken for approval. > > 3. If approved, the submission will be added as a Custom Downloadable > > Product , and files will be automatically added to a zip file. > > 4. User content now available for purchase. > > > The two approaches I have seen for creating a custom product include > > (1) Inheriting the Product model (http://thisismedium.com/tech/satchmo- > > diaries-part-one/) and (2) Establishing a OneToOne relationship with > > the Product model (http://www.satchmoproject.com/docs/svn/custom- > > product.html). For a traditional store I would probably just use > > model inheritance, but seeing that not all user submitted content will > > become products for this project, the OneToOne relationship seems to > > make the most sense. Here's an example of how I think the models > > should look at this point: > > > class UserContent(models.Model): > > name = models.CharField(max_length=255) > > user = models.ForeignKey(User, related_name='submitted_content') > > short_description = models.TextField(max_length=200) > > description = models.TextField() > > #ill probably use a separate file attachment model > > ... > > from product.models import Product > > > #created when the UserContent object is approved > > class UserDownloadableProduct(models.Model): > > product = models.OneToOneField(Product, verbose_name=_('Product'), > > primary_key=True) > > content = models.ForeignKey(UserContent) > > file = FileField(_("File"), upload_to=_protected_dir) #zip > > file > > ... > > > As you can see, even though not every UserContent object will become a > > UserDownloadableProduct, I have to collect some of the same data as > > the satchmo Product model (name, short_description, description, etc) > > so that I can eventually create a Product with that data for those > > that are approved. This is where the model inheritance approach seems > > to have an advantage (so that I'm not duplicating data), but as I > > described earlier, it seems like a bad idea to create a Product for > > every user submitted content (since some of them will be rejected). > > > Anyways, I would appreciate some feedback about the direction I'm > > heading with this project. Am I taking the best approach for creating > > a custom downloadable product? For UserDownloadableProduct, should I > > just reuse most of the DownloadableProduct model code that is packaged > > with satchmo? Is there anything else I need to consider? Any > > feedback or insight would be appreciated. > > > Thanks! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
