Skip to content

Commit

Permalink
fix: segment limit validation versioning (#8)
Browse files Browse the repository at this point in the history
* Update validation check for number of project segments

* Bump version
  • Loading branch information
matthewelwell authored Dec 4, 2024
1 parent 8b82fab commit 53dfd17
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion common/segments/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,12 @@ def update(
return response

def validate_project_segment_limit(self, project: models.Model) -> None:
if project.segments.count() >= project.max_segments_allowed:
if (
apps.get_model("segments", "Segment")
.objects.filter(project=project)
.count()
>= project.max_segments_allowed
):
raise ValidationError(
{
"project": "The project has reached the maximum allowed segments limit."
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "flagsmith_common"
version = "0.1.0"
version = "1.4.1"
description = "A repository for including code that is required in multiple flagsmith repositories"
authors = ["Matthew Elwell <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit 53dfd17

Please sign in to comment.