Skip to content

Commit

Permalink
refactor: add comment and update error message
Browse files Browse the repository at this point in the history
  • Loading branch information
rpenido committed Sep 19, 2023
1 parent 73aad4e commit 876dfe5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion openedx_tagging/core/tagging/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,11 +408,12 @@ def _check_current_tag_count() -> None:
"""
Checks if the current count of tags for the object is less than 100
"""
# Exclude self.id to avoid counting the tags that are going to be updated
current_count = ObjectTag.objects.filter(object_id=object_id).exclude(taxonomy_id=self.id).count()

if current_count >= 100:
raise ValueError(
_(f"Object ({object_id}) already have 100 tags.")
_(f"Object ({object_id}) already have 100 or more tags.")
)

_check_current_tag_count()
Expand Down

0 comments on commit 876dfe5

Please sign in to comment.