Skip to content

Commit

Permalink
Change object_id to CharField because of MySQL's length requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdanpetrea committed Feb 12, 2024
1 parent b82770f commit c90c852
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion django_woah/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class Migration(migrations.Migration):
),
),
("perm", models.CharField(max_length=128)),
("object_id", models.TextField(blank=True, null=True)),
("object_id", models.CharField(blank=True, max_length=16, null=True)),
("non_model_resource_id", models.TextField(blank=True, null=True)),
(
"content_type",
Expand Down
6 changes: 4 additions & 2 deletions django_woah/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,10 @@ class AssignedPerm(AutoCleanModel):
)
perm = models.CharField(max_length=128)

content_type = models.ForeignKey(ContentType, models.CASCADE, null=True, blank=True)
object_id = models.TextField(null=True, blank=True)
content_type = models.ForeignKey(
ContentType, on_delete=models.CASCADE, null=True, blank=True
)
object_id = models.CharField(null=True, blank=True, max_length=16)
resource = GenericForeignKey("content_type", "object_id")

non_model_resource_id = models.TextField(null=True, blank=True)
Expand Down

0 comments on commit c90c852

Please sign in to comment.