Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GSoC2024] - fix/attribute-text-length-limited-for-adding-values #7761

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Changed

- Doubled the maximum length of the attribute values.
ritikraj26 marked this conversation as resolved.
Show resolved Hide resolved
(<https://github.com/cvat-ai/cvat/pull/7761>)
18 changes: 18 additions & 0 deletions cvat/apps/engine/migrations/0079_alter_attributespec_values.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.11 on 2024-04-12 21:44

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("engine", "0078_alter_cloudstorage_credentials"),
]

operations = [
migrations.AlterField(
model_name="attributespec",
name="values",
field=models.CharField(blank=True, max_length=8192),
),
]
2 changes: 1 addition & 1 deletion cvat/apps/engine/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ class AttributeSpec(models.Model):
input_type = models.CharField(max_length=16,
choices=AttributeType.choices())
default_value = models.CharField(blank=True, max_length=128)
values = models.CharField(blank=True, max_length=4096)
values = models.CharField(blank=True, max_length=8192)
Copy link
Contributor

@Marishka17 Marishka17 Jun 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, it is not a good solution to increase the limit here and use CharField. Since we're using PostgreSQL, there shouldn't be any problems with wasting memory when the values field is small, but... Perhaps it will be better to use TextField here and add a limit in the code (but not to the values field since we store a list with attribute values in a string with a custom separator) - introduce an upper limit on the max number of characters for an attribute value and max number of attributes. + This looks logical to me also because we have a limit for AttributeVal.value.


class Meta:
default_permissions = ()
Expand Down
Loading