Import and PEP8 cleanups

This commit is contained in:
Roberto Rosario
2012-07-26 22:42:36 -04:00
parent 24bf20b9d7
commit eecf7c7751
69 changed files with 173 additions and 253 deletions

View File

@@ -38,11 +38,11 @@ class SourceLogManager(models.Manager):
to_delete = self.model.objects.filter(content_type=content_type, object_id=source.pk).order_by('-creation_datetime')[LOG_SIZE:]
for recent_to_delete in to_delete:
recent_to_delete.delete()
def get_for_source(self, source):
content_type = ContentType.objects.get_for_model(source)
return self.model.objects.filter(content_type=content_type, object_id=source.pk).order_by('-creation_datetime')
def get_latest_for(self, source):
content_type = ContentType.objects.get_for_model(source)
return self.model.objects.filter(content_type=content_type, object_id=source.pk).latest().creation_datetime