LeVon
I applied your patch and it resolved the error but what I noticed is that
if a metadata field has no value selected, the metadata is still applied to
document, albeit with no value. I believe it should not be applied to the
document at all. So I think there needs to be a second part to this patch
that checks if a value has been defined before applying the metadata to the
document. I had a look at the code but it is way beyond my coding abilities
:(
Thank you for this patch which helped me move forward in my testing.
Chris
On Tuesday, February 2, 2016 at 11:54:58 AM UTC-5, LeVon Smoker wrote:
>
> I fixed the problem by changing line 129 in mayan/apps/metadata/models.py
> from:
>
> if self.lookup:
> lookup_options = self.get_lookup_values()
> if value not in lookup_options:
> raise ValidationError(
> _('Value is not one of the provided options.')
> )
>
> to:
> if self.lookup:
> lookup_options = self.get_lookup_values()
> if value and value not in lookup_options:
> raise ValidationError(
> _('Value is not one of the provided options.')
> )
>
> Adding the 'value and' to the if statement allows empty values. Of course
> if the metadata type is required, that will be caught by the preceding code
> and raise the appropriate error.
>
> Thoughts?
>
> LeVon S.
>
>
> On Monday, February 1, 2016 at 1:44:15 PM UTC-5, LeVon Smoker wrote:
>>
>> I'm having trouble getting optional metadata types to work when the type
>> has a list of lookup options. When I try to upload a document that has
>> optional metadata and I don't choose from the dropdown boxes, I get an
>> error message - "Value is not one of the provided options." See the
>> attachment. For the "Meeting Type" metadata I have 'Board', 'Management
>> Team', 'Supervisors' entered as options in the Lookup field. I could add a
>> value of None to the list but I think that defeats the purpose of allowing
>> for optional vs required metadata based on document type.
>>
>> Or am I missing something?
>>
>> Thanks,
>> LeVon Smoker
>>
>
--
---
You received this message because you are subscribed to the Google Groups
"Mayan EDMS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.