Fix queryset assigment, should always be of MetadataType not DocumentTypeMetadataType, errors out on Postgres.

This commit is contained in:
Roberto Rosario
2016-03-15 18:39:48 -04:00
parent 8ae61b87b5
commit 6bf352ecbb
2 changed files with 6 additions and 2 deletions

View File

@@ -101,7 +101,11 @@ class AddMetadataForm(forms.Form):
def __init__(self, *args, **kwargs):
document_type = kwargs.pop('document_type')
super(AddMetadataForm, self).__init__(*args, **kwargs)
self.fields['metadata_type'].queryset = document_type.metadata.all()
self.fields['metadata_type'].queryset = MetadataType.objects.filter(
pk__in=document_type.metadata.values_list(
'metadata_type', flat=True
)
)
class MetadataTypeForm(forms.ModelForm):