Skip to content
Snippets Groups Projects
Verified Commit feea1e23 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Fix unique constraint on personal notes

(cherry picked from commit d193a0e8)
parent 77521294
No related branches found
No related tags found
1 merge request!228Prepare release 2.0rc6
Pipeline #29675 passed
......@@ -18,6 +18,7 @@ Fixed
~~~~~
* Fix problems with displaying dates for events in the week and lesson view.
* Unique constraint on lesson documentations and personal notes did not work and caused racey duplicates.
`2.0rc5`_ - 2021-08-12
----------------------
......@@ -27,7 +28,6 @@ Fixed
* The _Delete personal note_ action didn't work due to wrong usage of ``bulk_update``.
* Groups and persons were shown multiple times in some forms due to filtering by permissions.
* Unique constraint on lesson documentations did not work and caused racey duplicates.
`2.0rc4`_ - 2021-08-01
----------------------
......
# Generated by Django 3.2.4 on 2021-08-29 13:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('alsijil', '0014_fix_unique_lesson_documentation'),
]
operations = [
migrations.RemoveConstraint(
model_name='personalnote',
name='unique_personal_note_per_object',
),
migrations.AddConstraint(
model_name='personalnote',
constraint=models.UniqueConstraint(fields=('week', 'year', 'lesson_period', 'person'), name='unique_note_per_lp'),
),
migrations.AddConstraint(
model_name='personalnote',
constraint=models.UniqueConstraint(fields=('week', 'year', 'event', 'person'), name='unique_note_per_ev'),
),
migrations.AddConstraint(
model_name='personalnote',
constraint=models.UniqueConstraint(fields=('week', 'year', 'extra_lesson', 'person'), name='unique_note_per_el'),
),
]
......@@ -283,8 +283,13 @@ class PersonalNote(RegisterObjectRelatedMixin, ExtensibleModel):
check=lesson_related_constraint_q, name="one_relation_only_personal_note"
),
models.UniqueConstraint(
fields=("lesson_period", "week", "year", "event", "extra_lesson"),
name="unique_personal_note_per_object",
fields=("week", "year", "lesson_period", "person"), name="unique_note_per_lp",
),
models.UniqueConstraint(
fields=("week", "year", "event", "person"), name="unique_note_per_ev",
),
models.UniqueConstraint(
fields=("week", "year", "extra_lesson", "person"), name="unique_note_per_el",
),
]
......@@ -373,16 +378,13 @@ class LessonDocumentation(RegisterObjectRelatedMixin, ExtensibleModel):
check=lesson_related_constraint_q, name="one_relation_only_lesson_documentation",
),
models.UniqueConstraint(
fields=("week", "year", "lesson_period"),
name="unique_documentation_per_lp",
fields=("week", "year", "lesson_period"), name="unique_documentation_per_lp",
),
models.UniqueConstraint(
fields=("week", "year", "event"),
name="unique_documentation_per_ev",
fields=("week", "year", "event"), name="unique_documentation_per_ev",
),
models.UniqueConstraint(
fields=("week", "year", "extra_lesson"),
name="unique_documentation_per_el",
fields=("week", "year", "extra_lesson"), name="unique_documentation_per_el",
),
]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment