flake8 cleanups
This commit is contained in:
@@ -153,7 +153,7 @@ class Document(models.Model):
|
||||
|
||||
def exists(self):
|
||||
return self.file.storage.exists(self.file.path)
|
||||
|
||||
|
||||
def get_metadata_string(self):
|
||||
return u', '.join([u'%s - %s' % (metadata.metadata_type, metadata.value) for metadata in self.documentmetadata_set.select_related('metadata_type', 'document').defer('document__document_type', 'document__file', 'document__description', 'document__file_filename', 'document__uuid', 'document__date_added', 'document__date_updated', 'document__file_mimetype', 'document__file_mime_encoding')])
|
||||
|
||||
@@ -284,7 +284,7 @@ class MetadataGroupManager(models.Manager):
|
||||
metadata_dict = {}
|
||||
for document_metadata in document.documentmetadata_set.all():
|
||||
metadata_dict['metadata_%s' % document_metadata.metadata_type.name] = document_metadata.value
|
||||
|
||||
|
||||
if group_obj:
|
||||
groups_qs = MetadataGroup.objects.filter((Q(document_type=document.document_type) | Q(document_type=None)) & Q(enabled=True) & Q(pk=group_obj.pk))
|
||||
else:
|
||||
@@ -317,9 +317,9 @@ class MetadataGroupManager(models.Manager):
|
||||
|
||||
if group_obj:
|
||||
return metadata_groups[group_obj], errors
|
||||
|
||||
|
||||
return metadata_groups, errors
|
||||
|
||||
|
||||
|
||||
class MetadataGroup(models.Model):
|
||||
document_type = models.ManyToManyField(DocumentType, null=True, blank=True,
|
||||
@@ -415,9 +415,9 @@ class RecentDocument(models.Model):
|
||||
user = models.ForeignKey(User, verbose_name=_(u'user'), editable=False)
|
||||
document = models.ForeignKey(Document, verbose_name=_(u'document'), editable=False)
|
||||
datetime_accessed = models.DateTimeField(verbose_name=_(u'accessed'), db_index=True)
|
||||
|
||||
|
||||
objects = RecentDocumentManager()
|
||||
|
||||
|
||||
def __unicode__(self):
|
||||
return unicode(self.document)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user