-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): reworking the admin and model for tos. Have introduced a '… (
#558) * feat(api): reworking the admin and model for tos. Have introduced a 'final' flag for tos. Once a tos is final it cannot be changed any more (from the admin) * feat(api): added action to make tos active --------- Co-authored-by: Gerald Iakobinyi-Pich <gerald@gitcoin.co>
- Loading branch information
Showing
8 changed files
with
219 additions
and
21 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
57 changes: 57 additions & 0 deletions
57
api/tos/migrations/0002_remove_tos_unique_active_tops_for_type_tos_final_and_more.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,57 @@ | ||
# Generated by Django 4.2.6 on 2024-03-26 16:52 | ||
|
||
import account.models | ||
import django.core.validators | ||
from django.db import migrations, models | ||
import re | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("tos", "0001_initial"), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveConstraint( | ||
model_name="tos", | ||
name="unique_active_tops_for_type", | ||
), | ||
migrations.AddField( | ||
model_name="tos", | ||
name="final", | ||
field=models.BooleanField( | ||
default=False, | ||
help_text="Once an object is made final, it cannot be edited any more. This is to prevent from editing TOS that might have been accepted by users.", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="tos", | ||
name="active", | ||
field=models.BooleanField( | ||
default=False, | ||
help_text="Only 1 active tos is alloed per type. The active is the one that will be required for users to approve", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="tosacceptanceproof", | ||
name="signature", | ||
field=account.models.EthSignature( | ||
max_length=132, | ||
validators=[ | ||
django.core.validators.RegexValidator( | ||
re.compile("^0x[A-Fa-f0-9]+$"), | ||
"Enter a valid hex string ", | ||
"invalid", | ||
) | ||
], | ||
), | ||
), | ||
migrations.AddConstraint( | ||
model_name="tos", | ||
constraint=models.UniqueConstraint( | ||
condition=models.Q(("active", True), ("final", True)), | ||
fields=("type", "final", "active"), | ||
name="Only 1 active final tos is allowed for any given type", | ||
), | ||
), | ||
] |
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,16 @@ | ||
# Generated by Django 4.2.6 on 2024-03-28 19:50 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("tos", "0002_remove_tos_unique_active_tops_for_type_tos_final_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelOptions( | ||
name="tos", | ||
options={"permissions": (("activate_tos", "Can activate TOS instances"),)}, | ||
), | ||
] |
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