Add filenames accesor for DocumentType model

This commit is contained in:
Roberto Rosario
2014-10-27 23:22:35 -04:00
parent 21d51accec
commit 6ad26f3c9a
2 changed files with 2 additions and 2 deletions

View File

@@ -540,7 +540,7 @@ class DocumentTypeFilename(models.Model):
List of filenames available to a specific document type for the
quick rename functionality
"""
document_type = models.ForeignKey(DocumentType, verbose_name=_(u'Document type'))
document_type = models.ForeignKey(DocumentType, related_name='filenames', verbose_name=_(u'Document type'))
filename = models.CharField(max_length=128, verbose_name=_(u'Filename'), db_index=True)
enabled = models.BooleanField(default=True, verbose_name=_(u'Enabled'))

View File

@@ -920,7 +920,7 @@ def document_type_filename_list(request, document_type_id):
document_type = get_object_or_404(DocumentType, pk=document_type_id)
context = {
'object_list': document_type.documenttypefilename_set.all(),
'object_list': document_type.filenames.all(),
'title': _(u'filenames for document type: %s') % document_type,
'object_name': _(u'Document type'),
'navigation_object_name': 'document_type',