forked from doubaniux/boofilsic
-
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enable multiple posts associate with one piece
- Loading branch information
Your Name
committed
Aug 26, 2023
1 parent
64fd20a
commit 6d7295f
Showing
15 changed files
with
188 additions
and
64 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
56 changes: 56 additions & 0 deletions
56
journal/migrations/0016_piecepost_piece_posts_piecepost_unique_piece_post.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,56 @@ | ||
# Generated by Django 4.2.4 on 2023-08-25 18:50 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("takahe", "0001_initial"), | ||
("journal", "0015_use_identity_support_remote_piece"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="PiecePost", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
( | ||
"piece", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, to="journal.piece" | ||
), | ||
), | ||
( | ||
"post", | ||
models.ForeignKey( | ||
db_constraint=False, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
to="takahe.post", | ||
), | ||
), | ||
], | ||
), | ||
migrations.AddField( | ||
model_name="piece", | ||
name="posts", | ||
field=models.ManyToManyField( | ||
related_name="pieces", through="journal.PiecePost", to="takahe.post" | ||
), | ||
), | ||
migrations.AddConstraint( | ||
model_name="piecepost", | ||
constraint=models.UniqueConstraint( | ||
fields=("piece", "post"), name="unique_piece_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 4.2.4 on 2023-08-26 00:59 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("journal", "0016_piecepost_piece_posts_piecepost_unique_piece_post"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelOptions( | ||
name="piece", | ||
options={"base_manager_name": "objects"}, | ||
), | ||
migrations.RemoveIndex( | ||
model_name="piece", | ||
name="journal_pie_post_id_6a74ff_idx", | ||
), | ||
migrations.RemoveField( | ||
model_name="piece", | ||
name="post_id", | ||
), | ||
] |
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
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<span> | ||
<a hx-get="{% url 'journal:piece_replies' piece.uuid %}" | ||
hx-swap="outerHTML" | ||
hx-trigger="click once" | ||
hx-target="#replies_{{ post.pk }}"> | ||
<i class="fa-solid fa-reply"></i> | ||
{% if post.stats.replies %}<span>{{ post.stats.replies }}</span>{% endif %} | ||
</a> | ||
</span> |
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
Oops, something went wrong.