diff options
Diffstat (limited to 'ishtar_common/forms.py')
-rw-r--r-- | ishtar_common/forms.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ishtar_common/forms.py b/ishtar_common/forms.py index 1f4d50d60..a69c65f0e 100644 --- a/ishtar_common/forms.py +++ b/ishtar_common/forms.py @@ -735,6 +735,14 @@ def get_form_selection( if self._main_key not in cleaned_data \ or not cleaned_data[self._main_key]: raise forms.ValidationError(self._not_selected_error) + + pk = self.cleaned_data[self._main_key] + try: + item = model.objects.get(pk=pk) + except model.DoesNotExist: + raise forms.ValidationError(_("Invalid selection.")) + if hasattr(item, "locked") and item.locked: + raise forms.ValidationError(_("This item is locked for edition.")) return cleaned_data attrs['clean'] = clean attrs['SEARCH_AND_SELECT'] = True |