-
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.
Merge pull request #30 from stuartmaxwell/page-parents
Page parents
- Loading branch information
Showing
18 changed files
with
1,157 additions
and
123 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
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
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,9 +1,25 @@ | ||
"""djpress admin configuration.""" | ||
|
||
from typing import ClassVar | ||
|
||
from django.contrib import admin | ||
|
||
# Register the models here. | ||
from djpress.models import Category, Post | ||
|
||
admin.site.register(Category) | ||
admin.site.register(Post) | ||
|
||
@admin.register(Category) | ||
class CategoryAdmin(admin.ModelAdmin): | ||
"""Category admin configuration.""" | ||
|
||
list_display: ClassVar["str"] = ["title", "slug"] | ||
|
||
|
||
@admin.register(Post) | ||
class PostAdmin(admin.ModelAdmin): | ||
"""Post admin configuration.""" | ||
|
||
list_display: ClassVar["str"] = ["post_type", "title", "slug", "date", "author"] | ||
list_display_links: ClassVar["str"] = ["title", "slug"] | ||
ordering: ClassVar["str"] = ["post_type", "-date"] # Displays pages first, then sorted by date. | ||
list_filter: ClassVar["str"] = ["post_type", "date", "author"] |
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,24 @@ | ||
# Generated by Django 5.1.2 on 2024-10-09 06:22 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("djpress", "0004_rename_name_category_title_category_menu_order"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="post", | ||
name="parent", | ||
field=models.ForeignKey( | ||
blank=True, | ||
null=True, | ||
on_delete=django.db.models.deletion.SET_NULL, | ||
related_name="children", | ||
to="djpress.post", | ||
), | ||
), | ||
] |
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,25 @@ | ||
# Generated by Django 5.1.2 on 2024-10-09 06:36 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("djpress", "0005_post_parent"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="post", | ||
name="parent", | ||
field=models.ForeignKey( | ||
blank=True, | ||
limit_choices_to={"post_type": "page"}, | ||
null=True, | ||
on_delete=django.db.models.deletion.SET_NULL, | ||
related_name="children", | ||
to="djpress.post", | ||
), | ||
), | ||
] |
Oops, something went wrong.