-
Notifications
You must be signed in to change notification settings - Fork 12
allow multiple comments per participation #1457
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
5869e27
migrate comments to ParticipationComment
jeriox 6306995
adapt views to use new comment model
jeriox 93d03e9
add visibility to forms
jeriox ecccbe2
fix migrations
jeriox 4732277
lint
jeriox 960e02a
fix tests
jeriox 7f614d5
merge migrations
jeriox 95f6d74
fix participation card
jeriox a0b4b7c
trim translations
jeriox 6fd0b5a
revert poetry.lock
jeriox 4a6b073
improve dispo layout
jeriox a6cfe15
address review
jeriox 533daef
fix typo
jeriox 6677eef
lint
jeriox a4704fb
fix rebase error
jeriox 964850d
fix visibility bugs
jeriox 7d04f8d
move widget to core
jeriox 9b1785e
translations
jeriox File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,87 @@ | ||
| # Generated by Django 5.0.9 on 2025-01-05 12:37 | ||
|
|
||
| import django.db.models.deletion | ||
| import django.utils.timezone | ||
| from django.conf import settings | ||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| def migrate_comment(apps, schema_editor): | ||
| ParticipationComment = apps.get_model("core", "ParticipationComment") | ||
| AbstractParticipation = apps.get_model("core", "AbstractParticipation") | ||
| db_alias = schema_editor.connection.alias | ||
| comments = [] | ||
| for participation in AbstractParticipation.objects.using(db_alias).all(): | ||
| if participation.comment: | ||
| comments.append( | ||
| ParticipationComment(participation=participation, text=participation.comment) | ||
| ) | ||
| ParticipationComment.objects.using(db_alias).bulk_create(comments) | ||
|
|
||
|
|
||
| def revert_comments(apps, schema_editor): | ||
| ParticipationComment = apps.get_model("core", "ParticipationComment") | ||
| db_alias = schema_editor.connection.alias | ||
| for comment in ParticipationComment.objects.using(db_alias).all(): | ||
| comment.participation.comment = comment.text | ||
| comment.participation.save() | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ("core", "0034_alter_eventtype_show_participant_data"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.CreateModel( | ||
| name="ParticipationComment", | ||
| fields=[ | ||
| ( | ||
| "id", | ||
| models.BigAutoField( | ||
| auto_created=True, primary_key=True, serialize=False, verbose_name="ID" | ||
| ), | ||
| ), | ||
| ( | ||
| "visible_for", | ||
| models.IntegerField( | ||
| choices=[ | ||
| (0, "responsibles only"), | ||
| (1, "responsibles and corresponding participant"), | ||
| (2, "everyone"), | ||
| ], | ||
| default=0, | ||
| verbose_name="visible for", | ||
| ), | ||
| ), | ||
| ("text", models.CharField(max_length=255, verbose_name="Comment")), | ||
| ( | ||
| "authored_by_responsible", | ||
| models.ForeignKey( | ||
| blank=True, | ||
| null=True, | ||
| on_delete=django.db.models.deletion.SET_NULL, | ||
| to=settings.AUTH_USER_MODEL, | ||
| ), | ||
| ), | ||
| ( | ||
| "created_at", | ||
| models.DateTimeField(auto_now_add=True), | ||
| ), | ||
| ( | ||
| "participation", | ||
| models.ForeignKey( | ||
| on_delete=django.db.models.deletion.CASCADE, | ||
| related_name="comments", | ||
| to="core.abstractparticipation", | ||
| ), | ||
| ), | ||
| ], | ||
| ), | ||
| migrations.RunPython(migrate_comment, revert_comments), | ||
| migrations.RemoveField( | ||
| model_name="abstractparticipation", | ||
| name="comment", | ||
| ), | ||
| ] | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.