feat: dynamic citation text and logo

This commit is contained in:
mohamad
2026-05-20 16:02:16 +03:30
parent 2341b32d4c
commit 24dd24e1c9
11 changed files with 181 additions and 29 deletions
+1 -1
View File
@@ -106,7 +106,7 @@ class ArticleAdmin(admin.ModelAdmin):
fieldsets = (
(None, {"fields": ("sub_product", "badge", "title")}),
("Description", {"fields": ("description_format", "description")}),
("Citation Badge", {"fields": ("citation_count_display",), "description": "Set a number to show the dashed citation circle badge at the bottom-right of the article card. Leave blank to hide it."}),
("Citation Badge", {"fields": ("citation_count_display", "citation_count_label"), "description": "Number and optional label for the dashed citation circle badge. Both are optional — a label without a number shows an empty circle with the label; neither hides the badge entirely."}),
("Settings", {"fields": ("order",)}),
)
@@ -0,0 +1,23 @@
# Generated by Django 5.0.2 on 2026-05-20 12:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('products', '0007_article_citation_count_display'),
]
operations = [
migrations.AddField(
model_name='article',
name='citation_count_label',
field=models.CharField(blank=True, default='', help_text="Optional label shown below the number in the citation circle badge (e.g. 'cited'). Leave blank to show no label.", max_length=50),
),
migrations.AlterField(
model_name='article',
name='citation_count_display',
field=models.PositiveSmallIntegerField(blank=True, help_text='Optional number shown in the dashed citation circle badge. Leave blank to show an empty circle (if a label is set) or hide the badge entirely.', null=True),
),
]
+7 -1
View File
@@ -139,7 +139,13 @@ class Article(models.Model):
citation_count_display = models.PositiveSmallIntegerField(
null=True,
blank=True,
help_text="Optional number shown in the dashed citation circle badge at the bottom of the article card. Leave blank to hide the badge.",
help_text="Optional number shown in the dashed citation circle badge. Leave blank to show an empty circle (if a label is set) or hide the badge entirely.",
)
citation_count_label = models.CharField(
max_length=50,
blank=True,
default="",
help_text="Optional label shown below the number in the citation circle badge (e.g. 'cited'). Leave blank to show no label.",
)
order = models.PositiveIntegerField(default=0)
created_at = models.DateTimeField(auto_now_add=True)