diff --git a/djangocms_blog/admin.py b/djangocms_blog/admin.py index e6f4555..e01c5e3 100755 --- a/djangocms_blog/admin.py +++ b/djangocms_blog/admin.py @@ -86,7 +86,7 @@ class PostAdmin(PlaceholderAdminMixin, FrontendEditableAdminMixin, enhance_exclude = ('main_image', 'tags') _fieldsets = [ (None, { - 'fields': [['title', 'categories', 'publish', 'app_config']] + 'fields': [['title', 'categories', 'publish', 'app_config'], ['related',]] }), (_('Info'), { 'fields': [['slug', 'tags'], diff --git a/djangocms_blog/migrations/0029_post_related.py b/djangocms_blog/migrations/0029_post_related.py new file mode 100644 index 0000000..1a252db --- /dev/null +++ b/djangocms_blog/migrations/0029_post_related.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.5 on 2017-04-07 07:35 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('djangocms_blog', '0028_auto_20170304_1040'), + ] + + operations = [ + migrations.AddField( + model_name='post', + name='related', + field=models.ManyToManyField(blank=True, to='djangocms_blog.Post', verbose_name='Related Posts'), + ), + ] diff --git a/djangocms_blog/models.py b/djangocms_blog/models.py index 63ab67a..47a343f 100644 --- a/djangocms_blog/models.py +++ b/djangocms_blog/models.py @@ -191,6 +191,8 @@ class Post(KnockerModel, ModelMeta, TranslatableModel): objects = GenericDateTaggedManager() tags = TaggableManager(blank=True, related_name='djangocms_blog_tags') + related = models.ManyToManyField('self', verbose_name=_('Related Posts'), blank=True, symmetrical=False) + _metadata = { 'title': 'get_title', 'description': 'get_description',