'ENGINE': 'django.db.backends.mysql',
'NAME': 'diggersdigest',
'USER': 'digger',
- 'PASSWORD': 'admin',
+ 'PASSWORD': 'admin',
'HOST': 'db',
'PORT': 3306,
}
'audio': ['Audio'],
}
+
+#########
+# Shop
+#########
+
+# Add Migration Module path see : https://github.com/stephenmcd/mezzanine/blob/master/docs/model-customization.rst#field-injection-caveats
+MIGRATION_MODULES = {
+ "shop": "diggersdigest.migrations.shop",
+}
+
+# USE or EXTEND the custom callback-uuid form
+SHOP_CHECKOUT_FORM_CLASS = 'payments.multipayments.forms.base.CallbackUUIDOrderForm'
+
+# Add the callback_uuid field to orders. This field is helpful for identifying
+# orders being checked out.
+EXTRA_MODEL_FIELDS = (
+# ...
+(
+"cartridge.shop.models.Order.callback_uuid",
+"django.db.models.CharField",
+(),
+{"blank" : False, "max_length" : 36},
+),
+# ...
+)
+
+PRIMARY_PAYMENT_PROCESSOR_IN_USE = True
+
+SECONDARY_PAYMENT_PROCESSORS = (
+# ...
+('paypal', {
+'name' : 'Pay With Pay-Pal',
+'form' : 'payments.multipayments.forms.paypal.PaypalSubmissionForm'
+}),
+# ...
+)
+
+# Currency type.
+PAYPAL_CURRENCY = "EUR"
+
+# Business account email. Sandbox emails look like this.
+PAYPAL_BUSINESS = 'pellerin@parisson.com'
+PAYPAL_RECEIVER_EMAIL = PAYPAL_BUSINESS
+
+# Use this to enable https on return URLs. This is strongly recommended! (Except for sandbox)
+PAYPAL_RETURN_WITH_HTTPS = False
+
+# Function that returns args for `reverse`.
+# URL is sent to PayPal as the for returning to a 'complete' landing page.
+PAYPAL_RETURN_URL = lambda cart, uuid, order_form: ('shop_complete', None, None)
+
+# Function that returns args for `reverse`.
+# URL is sent to PayPal as the URL to callback to for PayPal IPN.
+# Set to None if you do not wish to use IPN.
+PAYPAL_IPN_URL = lambda cart, uuid, order_form: ('my_paypal_ipn', None, {'uuid' : uuid})
+
+# URL the secondary-payment-form is submitted to
+# Dev example
+PAYPAL_SUBMIT_URL = 'https://www.sandbox.paypal.com/cgi-bin/webscr'
+# Prod example
+PAYPAL_SUBMIT_URL = 'https://www.paypal.com/cgi-bin/webscr'
+
+# For real use set to False
+PAYPAL_TEST = True
+
###################
# DEPLOY SETTINGS #
###################
--- /dev/null
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('shop', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='order',
+ name='callback_uuid',
+ field=models.CharField(default=0, max_length=36),
+ preserve_default=False,
+ ),
+ ]
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
-LANGUAGE_CODE = "en"
+LANGUAGE_CODE = "fr"
# Supported languages
LANGUAGES = (
+ ('fr', _('French')),
('en', _('English')),
)
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
-USE_I18N = False
+USE_I18N = True
AUTHENTICATION_BACKENDS = ("mezzanine.core.auth_backends.MezzanineBackend",)
# "mezzanine.mobile",
"records",
"records_shop",
+ "payments.multipayments",
+ 'paypal.standard.ipn',
)
# List of processors used by RequestContext to populate the context.
"django.core.context_processors.tz",
"mezzanine.conf.context_processors.settings",
"mezzanine.pages.context_processors.page",
+ "payments.multipayments.context_processors.settings",
)
# List of middleware classes to use. Order is important; in the request phase,
PACKAGE_NAME_FILEBROWSER = "filebrowser_safe"
PACKAGE_NAME_GRAPPELLI = "grappelli_safe"
-# Add Migration Module path see : https://github.com/stephenmcd/mezzanine/blob/master/docs/model-customization.rst#field-injection-caveats
-MIGRATION_MODULES = {
- "shop": "diggersdigest.migrations.shop",
-}
#########################
# OPTIONAL APPLICATIONS #
#########################
PACKAGE_NAME_FILEBROWSER,
PACKAGE_NAME_GRAPPELLI,
)
-
+
##################
# LOCAL SETTINGS #
##################
from .models import Record
from .models import Podcast
from .models import ConditionGrading
-
+
+class RecordInline(admin.StackedInline):
+ model = Record
+ extra = 0
+
admin.site.register(Gallery)
admin.site.register(Grading)
admin.site.register(Link)
--- /dev/null
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('shop', '0001_initial'),
+ ('records', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='record',
+ name='product',
+ field=models.ForeignKey(related_name='records', on_delete=django.db.models.deletion.SET_NULL, verbose_name='product', to='shop.Product', null=True),
+ ),
+ migrations.AlterField(
+ model_name='record',
+ name='performers',
+ field=models.ManyToManyField(related_name='records_performers', verbose_name='performers', to='records.Artist'),
+ ),
+ ]
from mezzanine.blog.models import BlogPost
from mezzanine.utils.models import upload_to
+from cartridge.shop.models import Product, ProductVariation
# Auto-generated Django models with manage.py inspectdb on the old database
# You'll have to do the following manually to clean this up:
def __unicode__(self):
return " = ".join([self.abbr, self.name])
-
+
class Record(models.Model):
"""
Model for Record
(ON_HOLD, 'On Hold'),
(JUST_SOLD, 'Just Sold')
)
- title = models.CharField(max_length=128)
+ title = models.CharField(max_length=128)
artist = models.ForeignKey(Artist, verbose_name=_('artist'), related_name='records_artists', null=True, on_delete=models.SET_NULL)
- performers = models.ManyToManyField(Artist, verbose_name=_('performer'), related_name='records_performers')
+ performers = models.ManyToManyField(Artist, verbose_name=_('performers'), related_name='records_performers')
record_status = models.IntegerField(_('record status'), choices=NOVELTY_CHOICES, default=NEW)
label = models.ForeignKey(Label, verbose_name=_('label'), related_name='records', null=True, on_delete=models.SET_NULL)
release_date = models.DateField(_('release date'), null=True)
#vinyl_state = models.ForeignKey(ConditionGrading, verbose_name=_('vinyl condition'), related_name='records_vinyl_condition', null=True, on_delete=models.SET_NULL)
audio_file = FileField(_("audio file"), max_length=1024, format="audio",
upload_to=upload_to("records.Record.audio", "audio/records"), null=True)
-
+ product = models.ForeignKey(Product, verbose_name=_('product'), related_name='records', null=True, on_delete=models.SET_NULL)
def __unicode__(self):
return " - ".join([self.artist.name, self.title])
from django.contrib import admin
+from records.admin import RecordInline
+from cartridge.shop.models import Product, ProductVariation
+from cartridge.shop.admin import ProductAdmin, ProductImageAdmin, ProductVariationAdmin
# Register your models here.
from .models import RecordProduct
-admin.site.register(RecordProduct)
+class RecordProductAdmin(ProductAdmin):
+ inlines = [ProductImageAdmin, ProductVariationAdmin, RecordInline]
+
+admin.site.unregister(Product)
+admin.site.register(Product, RecordProductAdmin)
Django==1.8.3
MySQL-python==1.2.5
cartridge==0.10.0
+cartridge-payments==0.97.0
+django-paypal==0.2.5
+django-uuidfield==0.5.0
+django-newsletter==0.5.2