Ticket #14226: dumpdata.patch
File dumpdata.patch, 1.3 KB (added by , 14 years ago) |
---|
-
django/core/management/commands/dumpdata.py
132 132 if model_list is None: 133 133 model_list = get_models(app) 134 134 135 for model in model_list: 135 while model_list: 136 model = model_list.pop() 136 137 models.add(model) 137 138 # Add any explicitly defined dependencies 138 139 if hasattr(model, 'natural_key'): … … 150 151 if hasattr(rel_model, 'natural_key'): 151 152 deps.append(rel_model) 152 153 for field in model._meta.many_to_many: 153 rel_model = field.rel.to 154 if hasattr(rel_model, 'natural_key'): 155 deps.append(rel_model) 154 m2m_model = field.rel.through 155 if hasattr(m2m_model, 'natural_key'): 156 # if the m2m model is not in the model_dependencies list, 157 # add it for processing 158 if not any((m[0]==m2m_model for m in model_dependencies)): 159 model_list.append(m2m_model) 160 156 161 model_dependencies.append((model, deps)) 157 162 158 163 model_dependencies.reverse()