# 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",
+ "blog": "diggersdigest.migrations.blog"
}
# 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 = (
--- /dev/null
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+import mezzanine.core.fields
+import mezzanine.utils.models
+from django.conf import settings
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('sites', '0001_initial'),
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='BlogCategory',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('title', models.CharField(max_length=500, verbose_name='Title')),
+ ('slug', models.CharField(help_text='Leave blank to have the URL auto-generated from the title.', max_length=2000, null=True, verbose_name='URL', blank=True)),
+ ('site', models.ForeignKey(editable=False, to='sites.Site')),
+ ],
+ options={
+ 'ordering': ('title',),
+ 'verbose_name': 'Blog Category',
+ 'verbose_name_plural': 'Blog Categories',
+ },
+ bases=(models.Model,),
+ ),
+ migrations.CreateModel(
+ name='BlogPost',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('comments_count', models.IntegerField(default=0, editable=False)),
+ ('keywords_string', models.CharField(max_length=500, editable=False, blank=True)),
+ ('rating_count', models.IntegerField(default=0, editable=False)),
+ ('rating_sum', models.IntegerField(default=0, editable=False)),
+ ('rating_average', models.FloatField(default=0, editable=False)),
+ ('title', models.CharField(max_length=500, verbose_name='Title')),
+ ('slug', models.CharField(help_text='Leave blank to have the URL auto-generated from the title.', max_length=2000, null=True, verbose_name='URL', blank=True)),
+ ('_meta_title', models.CharField(help_text='Optional title to be used in the HTML title tag. If left blank, the main title field will be used.', max_length=500, null=True, verbose_name='Title', blank=True)),
+ ('description', models.TextField(verbose_name='Description', blank=True)),
+ ('gen_description', models.BooleanField(default=True, help_text='If checked, the description will be automatically generated from content. Uncheck if you want to manually set a custom description.', verbose_name='Generate description')),
+ ('created', models.DateTimeField(null=True, editable=False)),
+ ('updated', models.DateTimeField(null=True, editable=False)),
+ ('status', models.IntegerField(default=2, help_text='With Draft chosen, will only be shown for admin users on the site.', verbose_name='Status', choices=[(1, 'Draft'), (2, 'Published')])),
+ ('publish_date', models.DateTimeField(help_text="With Published chosen, won't be shown until this time", null=True, verbose_name='Published from', blank=True)),
+ ('expiry_date', models.DateTimeField(help_text="With Published chosen, won't be shown after this time", null=True, verbose_name='Expires on', blank=True)),
+ ('short_url', models.URLField(null=True, blank=True)),
+ ('in_sitemap', models.BooleanField(default=True, verbose_name='Show in sitemap')),
+ ('content', mezzanine.core.fields.RichTextField(verbose_name='Content')),
+ ('allow_comments', models.BooleanField(default=True, verbose_name='Allow comments')),
+ ('featured_image', mezzanine.core.fields.FileField(max_length=255, null=True, verbose_name='Featured Image', blank=True)),
+ ('categories', models.ManyToManyField(related_name='blogposts', verbose_name='Categories', to='blog.BlogCategory', blank=True)),
+ ('related_posts', models.ManyToManyField(related_name='related_posts_rel_+', verbose_name='Related posts', to='blog.BlogPost', blank=True)),
+ ('site', models.ForeignKey(editable=False, to='sites.Site')),
+ ('user', models.ForeignKey(related_name='blogposts', verbose_name='Author', to=settings.AUTH_USER_MODEL)),
+ ],
+ options={
+ 'ordering': ('-publish_date',),
+ 'verbose_name': 'Blog post',
+ 'verbose_name_plural': 'Blog posts',
+ },
+ bases=(models.Model, mezzanine.utils.models.AdminThumbMixin),
+ ),
+ ]
--- /dev/null
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('blog', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='blogpost',
+ name='publish_date',
+ field=models.DateTimeField(help_text="With Published chosen, won't be shown until this time", null=True, verbose_name='Published from', db_index=True, blank=True),
+ ),
+ ]
--- /dev/null
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('shop', '0003_auto_20150906_1911'),
+ ('blog', '0002_auto_20150527_1555'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='blogpost',
+ name='related_products',
+ field=models.ManyToManyField(to='shop.Product', verbose_name=b'Related products', blank=True),
+ ),
+ ]
# field instance. When specifying the field class, the path
# ``django.models.db.`` can be omitted for regular Django model fields.
#
-# EXTRA_MODEL_FIELDS = (
-# (
-# # Dotted path to field.
-# "mezzanine.blog.models.BlogPost.image",
-# # Dotted path to field class.
-# "somelib.fields.ImageField",
-# # Positional args for field class.
-# (_("Image"),),
-# # Keyword args for field class.
-# {"blank": True, "upload_to": "blog"},
-# ),
-# # Example of adding a field to *all* of Mezzanine's content types:
-# (
-# "mezzanine.pages.models.Page.another_field",
-# "IntegerField", # 'django.db.models.' is implied if path is omitted.
-# (_("Another name"),),
-# {"blank": True, "default": 1},
-# ),
-# )
+
+EXTRA_MODEL_FIELDS = (
+ (
+ # Dotted path to field.# Dotted path to field.
+ "mezzanine.blog.models.BlogPost.related_products",
+ # Dotted path to field class.
+ "django.db.models.ManyToManyField",
+ # Positional args for field class.
+ ("shop.Product",),
+ # Keyword args for field class.
+ {"verbose_name": ("Related products"), "blank": True},
+ ),
+ # Add the callback_uuid field to orders. This field is helpful for identifying
+ # orders being checked out.
+ (
+ "cartridge.shop.models.Order.callback_uuid",
+ "django.db.models.CharField",
+ (),
+ {"blank" : False, "max_length" : 36},
+ )
+ # ...
+ # # Example of adding a field to *all* of Mezzanine's content types:
+ # (
+ # "mezzanine.pages.models.Page.another_field",
+ # "IntegerField", # 'django.db.models.' is implied if path is omitted.
+ # (_("Another name"),),
+ # {"blank": True, "default": 1},
+ # ),
+ )
# Setting to turn on featured images for blog posts. Defaults to False.
#
+from copy import deepcopy
+
from django.contrib import admin
+from django.utils.translation import ugettext_lazy as _
+
from cartridge.shop.models import Product, ProductImage, ProductVariation
from cartridge.shop.admin import ProductAdmin, ProductImageAdmin, ProductVariationAdmin
+from mezzanine.blog.admin import BlogPostAdmin
+from mezzanine.blog.models import BlogPost
+
# Register your models here.
from .models import Gallery
from .models import Grading
search_fields = ["title", "artist__name", "label__name"]
filter_horizontal = ["performers"]
+
+blog_fieldsets = deepcopy(BlogPostAdmin.fieldsets)
+blog_fieldsets.insert(1, (_("Related products"), {
+ "classes": ("collapse-closed",),
+ "fields": ("related_products",)}))
+blog_filter_horizontal = BlogPostAdmin.filter_horizontal
+blog_filter_horizontal += ("related_products", )
+
+
+class MyBlogPostAdmin(BlogPostAdmin):
+ fieldsets = blog_fieldsets
+ filter_horizontal = blog_filter_horizontal
+
+admin.site.unregister(BlogPost)
+admin.site.register(BlogPost, MyBlogPostAdmin)
+
+
admin.site.unregister(Product)
admin.site.register(Product, RecordProductAdmin)
--- /dev/null
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('records', '0009_remove_record_image'),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(
+ name='artist',
+ options={'ordering': ['name']},
+ ),
+ ]
from mezzanine.blog.models import BlogPost
from mezzanine.utils.models import upload_to
-from cartridge.shop.models import Product
+from cartridge.shop.models import Product, Category
# Auto-generated Django models with manage.py inspectdb on the old database