forked from cvat-ai/cvat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow attribute default/permitted values to be blank (cvat-ai#6454)
This is de facto already allowed when CVAT is accessed via the UI/API, even though the model/serializer configuration seem to prohibit it. That's because validation for attribute properties is effectively disabled on the server due to a bug. However, the SDK checks the schema, and thus doesn't allow such values. I think blank default values make sense (particularly for "text" type attributes), so I updated the code to allow them. Blank permitted values don't make quite as much sense, but I had to allow them too, because the UI always submits the default value as the first permitted value (even for freeform text attributes). This will let us fix the broken validation on the server side (which I'm planning to do soon) without removing the ability to set blank default attribute values via the UI. (FWIW, I don't think that the UI should add a `values` property when serializing freeform text attributes at all, but it would take a more substantial change to fix that, which I don't have time for right now.)
- Loading branch information
Showing
6 changed files
with
51 additions
and
8 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
22 changes: 22 additions & 0 deletions
22
cvat/apps/engine/migrations/0073_alter_attributespec_default_value_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,22 @@ | ||
# Generated by Django 4.2.1 on 2023-07-10 15:57 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("engine", "0072_alter_issue_updated_date"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="attributespec", | ||
name="default_value", | ||
field=models.CharField(blank=True, max_length=128), | ||
), | ||
migrations.AlterField( | ||
model_name="attributespec", | ||
name="values", | ||
field=models.CharField(blank=True, max_length=4096), | ||
), | ||
] |
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
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