mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-22 06:26:56 +01:00
Enhancement: use stable unique IDs for custom field select options (#8299)
This commit is contained in:
parent
00485138f9
commit
0fc1860d4c
24 changed files with 494 additions and 101 deletions
|
|
@ -947,7 +947,7 @@ class CustomFieldInstance(SoftDeleteModel):
|
|||
|
||||
value_document_ids = models.JSONField(null=True)
|
||||
|
||||
value_select = models.PositiveSmallIntegerField(null=True)
|
||||
value_select = models.CharField(null=True, max_length=16)
|
||||
|
||||
class Meta:
|
||||
ordering = ("created",)
|
||||
|
|
@ -962,7 +962,11 @@ class CustomFieldInstance(SoftDeleteModel):
|
|||
|
||||
def __str__(self) -> str:
|
||||
value = (
|
||||
self.field.extra_data["select_options"][self.value_select]
|
||||
next(
|
||||
option.get("label")
|
||||
for option in self.field.extra_data["select_options"]
|
||||
if option.get("id") == self.value_select
|
||||
)
|
||||
if (
|
||||
self.field.data_type == CustomField.FieldDataType.SELECT
|
||||
and self.value_select is not None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue