77
88
99def swappable_setting (app_label , model ):
10- """
11- Returns the setting name to use for the given model (i.e. AUTH_USER_MODEL)
10+ """Returns the setting name to use for the given model
11+
12+ Returns the setting name to use for the given model (i.e.
13+ AUTH_USER_MODEL)
1214 """
1315 prefix = _prefixes .get (app_label , app_label )
1416 setting = "{prefix}_{model}_MODEL" .format (
@@ -23,7 +25,8 @@ def swappable_setting(app_label, model):
2325
2426
2527def is_swapped (app_label , model ):
26- """
28+ """Returns the value of the swapped setting.
29+
2730 Returns the value of the swapped setting, or False if the model hasn't
2831 been swapped.
2932 """
@@ -37,15 +40,17 @@ def is_swapped(app_label, model):
3740
3841
3942def get_model_name (app_label , model ):
40- """
41- Returns [app_label.model] unless the model has been swapped, in which case
42- returns the swappable setting value.
43+ """Returns [app_label.model].
44+
45+ Returns [app_label.model] unless the model has been swapped, in which
46+ case returns the swappable setting value.
4347 """
4448 return is_swapped (app_label , model ) or join (app_label , model )
4549
4650
4751def dependency (app_label , model , version = None ):
48- """
52+ """Returns a Django 1.7+ style dependency tuple
53+
4954 Returns a Django 1.7+ style dependency tuple for inclusion in
5055 migration.dependencies[]
5156 """
@@ -56,16 +61,12 @@ def dependency(app_label, model, version=None):
5661
5762
5863def get_model_names (app_label , models ):
59- """
60- Map model names to their swapped equivalents for the given app
61- """
64+ """Map model names to their swapped equivalents for the given app"""
6265 return dict ((model , get_model_name (app_label , model )) for model in models )
6366
6467
6568def load_model (app_label , model , required = True , require_ready = True ):
66- """
67- Load the specified model class, or the class it was swapped out for.
68- """
69+ """Load the specified model class, or the class it was swapped out for."""
6970 swapped = is_swapped (app_label , model )
7071 if swapped :
7172 app_label , model = split (swapped )
@@ -83,9 +84,7 @@ def load_model(app_label, model, required=True, require_ready=True):
8384
8485
8586def set_app_prefix (app_label , prefix ):
86- """
87- Set a custom prefix to use for the given app (e.g. WQ)
88- """
87+ """Set a custom prefix to use for the given app (e.g. WQ)"""
8988 _prefixes [app_label ] = prefix
9089
9190
0 commit comments