Close issue #105, Tie smart links setups to document types

This commit is contained in:
Roberto Rosario
2014-11-06 20:45:10 -04:00
parent c9c38ce5ed
commit ba60012c98
10 changed files with 171 additions and 20 deletions

View File

@@ -20,10 +20,12 @@ class SmartLinkManager(models.Manager):
eval_dict['document'] = document
eval_dict['metadata'] = MetadataClass(metadata_dict)
smart_link_qs = self.model.objects.filter(enabled=True)
if smart_link_obj:
smart_link_qs = self.model.objects.filter(Q(enabled=True) & Q(pk=smart_link_obj.pk))
else:
smart_link_qs = self.model.objects.filter(enabled=True)
smart_link_qs= smart_link_qs.filter(pk=smart_link_obj.pk)
smart_link_qs = smart_link_qs.filter(document_types=document.document_type)
for smart_link in smart_link_qs:
total_query = Q()