def drop_empty_translationprojects(apps, schema_editor):
 Directory = apps.get_model(u'pootle_app.Directory')
 TP = apps.get_model(u'pootle_translationproject.TranslationProject')
 for tp in TP.objects.all():
  if (not Directory.objects.filter(pootle_path=tp.pootle_path).exists()):
   tp.delete()

def drop_empty_translationprojects ( apps , schema_editor ) : Directory = apps . get_model ( u'pootle_app.Directory' ) TP = apps . get_model ( u'pootle_translationproject.TranslationProject' ) for tp in TP . objects . all ( ) : if ( not Directory . objects . filter ( pootle_path = tp . pootle_path ) . exists ( ) ) : tp . delete ( )
drop tps with no directories .