From 6f386b0acb9edae1ff1bde00ed76e4448b608d91 Mon Sep 17 00:00:00 2001
From: Andrew Godwin <andrew@aeracode.org>
Date: Fri, 25 Jul 2014 09:43:54 -0700
Subject: [PATCH] Restore support for reading __latest__ for compatability

---
 django/db/migrations/loader.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/django/db/migrations/loader.py b/django/db/migrations/loader.py
index 5c240ca739..5465f0ad18 100644
--- a/django/db/migrations/loader.py
+++ b/django/db/migrations/loader.py
@@ -136,7 +136,7 @@ class MigrationLoader(object):
             return self.disk_migrations[results[0]]
 
     def check_key(self, key, current_app):
-        if key[1] != "__first__" or key in self.graph:
+        if (key[1] != "__first__" and key[1] != "__latest__") or key in self.graph:
             return key
         # Special-case __first__, which means "the first migration" for
         # migrated apps, and is ignored for unmigrated apps. It allows