Need help in implementing a digital product-only store.

672 views
Skip to first unread message

Noel Martin Llevares

unread,
Dec 22, 2014, 5:18:52 AM12/22/14
to django...@googlegroups.com
Hi everyone,

I'm very new to Django-Oscar. I am in the process of creating an online store that sells digital products only.

From a high-level point-of-view, the requirements are pretty basic. Users can basically buy any product and once checkout and payment succeeds, they get an email with a unique, one-time use only, expirable link in order to download the product(s) they bought.

The above use-case seems to be pretty common but I'm at a loss as to how to implement that on Django-Oscar. I find Django-Oscar very robust and flexible to handle any kind of e-commerce use-case out there knowing that you can easily override/extend any of the core functionalities of Django Oscar.

My dead end as of the moment:

I want to customize the Product model to include a FileField where I can attach the actual product (a downloadable PDF for example). Then, after that I wish to customize the checkout process so that I can generate the one-time download links and email it to the customer.

I've already gone through and read Customizing Oscar, Forking an App, and followed How to Customize Models. However, ./manage.py makemigrations does not detect the model changes I made.

This code is from forks/catalogue/models.py...

from django.db import models
from oscar.apps.catalogue.abstract_models import AbstractProduct


class Product(AbstractProduct):
    basic_file
= models.FileField(upload_to='products/basic')
    premium_file
= models.FileField(upload_to='products/premium')

from oscar.apps.catalogue.models import *


This is the file structure...

.
├── conf
  ├── __init__.py
  ├── settings.py
  ├── urls.py
  └── wsgi.py
├── db.sqlite3
├── forks
  ├── __init__.py
  └── catalogue
      ├── __init__.py
      ├── admin.py
      ├── config.py
      ├── migrations
        ├── 0001_initial.py
        └── __init__.py
      ├── models.py
      └── south_migrations
          ├── ... lots of migration files here ...
          └── __init__.py
├── manage.py
└── media

I tried using ./manage shell to import my customized model and this is what came out...

>>> from forks.catalogue.models import Product
... long stack trace here ...
RuntimeError: Conflicting 'product_product_options' models in application 'catalogue': <class 'oscar.apps.catalogue.models.P
roduct_product_options'
> and <class 'forks.catalogue.models.Product_product_options'>.

I think I followed the documentation correctly but now I'm stuck and couldn't figure this out. 

Can anyone help me with this?
Can you point me to a tutorial somewhere else that will help me implement what I need? I couldn't find much material in Oscar's official docs about customizing it for digital, downloadable products.

Thank you very much and hope to get answers here.

I'm using Django 1.7.1 on Python 2.7.9 by the way.


Noel


Noel Martin Llevares

unread,
Dec 22, 2014, 5:38:00 AM12/22/14
to django...@googlegroups.com
By the way, INSTALLED_APPS setting is like this...

from oscar import get_core_apps

INSTALLED_APPS
= [
   
'django.contrib.admin',
   
'django.contrib.auth',
   
'django.contrib.contenttypes',
   
'django.contrib.sessions',
   
'django.contrib.messages',
   
'django.contrib.staticfiles',
   
'django.contrib.sites',
   
'django.contrib.flatpages',
   
'compressor'
] + get_core_apps('forks.catalogue')

Alexander Kaidalov

unread,
Dec 23, 2014, 9:25:51 AM12/23/14
to django...@googlegroups.com
Hi Noel,

You should pass a list to the get_core_apps()



понедельник, 22 декабря 2014 г., 13:38:00 UTC+3 пользователь Noel Martin Llevares написал:

David Winterbottom

unread,
Dec 23, 2014, 4:43:30 PM12/23/14
to django-oscar
​Not passing a list to get_core_apps is a common error, I'm going to add a type assertion to avoid that.​

PS - Be careful about storing private files in your MEDIA_ROOT (which is public by default). Here's a useful article: http://zacharyvoase.com/2009/09/08/sendfile/

--
https://github.com/tangentlabs/django-oscar
http://django-oscar.readthedocs.org/en/latest/
https://twitter.com/django_oscar
---
You received this message because you are subscribed to the Google Groups "django-oscar" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-oscar...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-oscar.
To view this discussion on the web, visit https://groups.google.com/d/msgid/django-oscar/ebfa9753-9a78-45d9-b00c-0ea149e2ae67%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Noel Martin Llevares

unread,
Dec 23, 2014, 5:00:54 PM12/23/14
to django...@googlegroups.com
Thank you for the responses. I have fixed it and am now continuing my customization.

David Winterbottom

unread,
Dec 23, 2014, 5:03:34 PM12/23/14
to django-oscar

--
https://github.com/tangentlabs/django-oscar
http://django-oscar.readthedocs.org/en/latest/
https://twitter.com/django_oscar
---
You received this message because you are subscribed to the Google Groups "django-oscar" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-oscar...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-oscar.

CpILL CodeMonkey

unread,
Nov 23, 2015, 11:55:24 PM11/23/15
to django-oscar
You should mention this in the 'How to customise models' section of the help and link to the "Replace Oscar’s app with your own in INSTALLED_APPS" section from there. 
Reply all
Reply to author
Forward
0 new messages