forked from nephila/djangocms-blog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add BlogFeaturedPostsPlugin to show selected posts (nephila#747)
- Loading branch information
Showing
8 changed files
with
277 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add BlogFeaturedPostsPlugin to show selected posts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
109 changes: 109 additions & 0 deletions
109
djangocms_blog/migrations/0042_alter_authorentriesplugin_cmsplugin_ptr_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
# Generated by Django 4.2.3 on 2023-08-04 09:10 | ||
|
||
import aldryn_apphooks_config.fields | ||
import django.db.models.deletion | ||
import sortedm2m.fields | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("cms", "0022_auto_20180620_1551"), | ||
("djangocms_blog", "0041_auto_20230720_1508"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="authorentriesplugin", | ||
name="cmsplugin_ptr", | ||
field=models.OneToOneField( | ||
auto_created=True, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
parent_link=True, | ||
primary_key=True, | ||
related_name="%(app_label)s_%(class)s", | ||
serialize=False, | ||
to="cms.cmsplugin", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="genericblogplugin", | ||
name="cmsplugin_ptr", | ||
field=models.OneToOneField( | ||
auto_created=True, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
parent_link=True, | ||
primary_key=True, | ||
related_name="%(app_label)s_%(class)s", | ||
serialize=False, | ||
to="cms.cmsplugin", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="latestpostsplugin", | ||
name="cmsplugin_ptr", | ||
field=models.OneToOneField( | ||
auto_created=True, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
parent_link=True, | ||
primary_key=True, | ||
related_name="%(app_label)s_%(class)s", | ||
serialize=False, | ||
to="cms.cmsplugin", | ||
), | ||
), | ||
migrations.CreateModel( | ||
name="FeaturedPostsPlugin", | ||
fields=[ | ||
( | ||
"cmsplugin_ptr", | ||
models.OneToOneField( | ||
auto_created=True, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
parent_link=True, | ||
primary_key=True, | ||
related_name="%(app_label)s_%(class)s", | ||
serialize=False, | ||
to="cms.cmsplugin", | ||
), | ||
), | ||
( | ||
"current_site", | ||
models.BooleanField( | ||
default=True, help_text="Select items from the current site only", verbose_name="current site" | ||
), | ||
), | ||
( | ||
"template_folder", | ||
models.CharField( | ||
choices=[("plugins", "Default template")], | ||
default="plugins", | ||
help_text="Select plugin template to load for this instance", | ||
max_length=200, | ||
verbose_name="Plugin template", | ||
), | ||
), | ||
( | ||
"app_config", | ||
aldryn_apphooks_config.fields.AppHookConfigField( | ||
blank=True, | ||
help_text="When selecting a value, the form is reloaded to get the updated default", | ||
null=True, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
to="djangocms_blog.blogconfig", | ||
verbose_name="app. config", | ||
), | ||
), | ||
( | ||
"posts", | ||
sortedm2m.fields.SortedManyToManyField( | ||
help_text=None, to="djangocms_blog.post", verbose_name="Featured posts" | ||
), | ||
), | ||
], | ||
options={ | ||
"abstract": False, | ||
}, | ||
bases=("cms.cmsplugin",), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
djangocms_blog/templates/djangocms_blog/plugins/featured_posts.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{% load i18n %}{% spaceless %} | ||
<div class="plugin plugin-blog"> | ||
<div class="blog-featured-posts"> | ||
{% for post in posts_list %} | ||
{% include "djangocms_blog/includes/blog_item.html" with post=post image="true" TRUNCWORDS_COUNT=TRUNCWORDS_COUNT %} | ||
{% endfor %} | ||
</div> | ||
</div> | ||
{% endspaceless %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters