-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Define name setter for
trix-editor
elements (#104)
- Loading branch information
Showing
4 changed files
with
89 additions
and
4 deletions.
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 |
---|---|---|
@@ -1,5 +1,14 @@ | ||
from django.contrib import admin | ||
|
||
from blog.models import Article | ||
from blog.models import Article, Comment | ||
|
||
admin.site.register(Article) | ||
|
||
class CommentAdminInline(admin.StackedInline): | ||
model = Comment | ||
|
||
|
||
class ArticleAdmin(admin.ModelAdmin): | ||
inlines = [CommentAdminInline] | ||
|
||
|
||
admin.site.register(Article, ArticleAdmin) |
50 changes: 50 additions & 0 deletions
50
example/blog/migrations/0005_alter_article_excerpt_comment.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,50 @@ | ||
# Generated by Django 4.2.14 on 2024-07-17 08:14 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import prose.fields | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
("blog", "0004_alter_article_excerpt"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="article", | ||
name="excerpt", | ||
field=prose.fields.RichTextField(blank=True, default=""), | ||
), | ||
migrations.CreateModel( | ||
name="Comment", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("body", prose.fields.RichTextField(blank=True, default="")), | ||
( | ||
"article", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, to="blog.article" | ||
), | ||
), | ||
( | ||
"author", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
to=settings.AUTH_USER_MODEL, | ||
), | ||
), | ||
], | ||
), | ||
] |
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