Preload metadata add form with metadata type valid for the context document.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2017-06-12 16:16:03 -04:00
parent b1ae091746
commit 6af1010f3a

View File

@@ -127,7 +127,9 @@ class DocumentMetadataAddView(MultipleObjectFormActionView):
if queryset.count() == 1: if queryset.count() == 1:
result.update( result.update(
{ {
'queryset': MetadataType.objects.exclude( 'queryset': MetadataType.objects.get_for_document_type(
document_type=queryset.first().document_type
).exclude(
pk__in=MetadataType.objects.get_for_document( pk__in=MetadataType.objects.get_for_document(
document=queryset.first() document=queryset.first()
) )