Re-write models.get_realm to use Django convenience function.

This commit is contained in:
Rishi Gupta 2017-01-08 11:35:24 -08:00 committed by Tim Abbott
parent 145c5da8bf
commit b22f574224
1 changed files with 1 additions and 6 deletions

View File

@ -244,12 +244,7 @@ post_save.connect(flush_realm, sender=Realm)
def get_realm(string_id):
# type: (Text) -> Optional[Realm]
if not string_id:
return None
try:
return Realm.objects.get(string_id=string_id)
except Realm.DoesNotExist:
return None
return Realm.objects.filter(string_id=string_id).first()
def completely_open(realm):
# type: (Realm) -> bool