def save(self, **kwargs):
child_relation_names = [rel.get_accessor_name() for rel in get_all_child_relations(self)]<EOL>child_m2m_field_names = [field.name for field in get_all_child_m2m_relations(self)]<EOL>update_fields = kwargs.pop('<STR_LIT>', None)<EOL>if update_fields is None:<EOL><INDENT>real_update_fields = None<EOL>relations_to_commit = child_relation_names<EOL>m2m_fields_to_commit = child_m2m_field_names<EOL><DEDENT>else:<EOL><INDENT>real_update_fields = []<EOL>relations_to_commit = []<EOL>m2m_fields_to_commit = []<EOL>for field in update_fields:<EOL><INDENT>if field in child_relation_names:<EOL><INDENT>relations_to_commit.append(field)<EOL><DEDENT>elif field in child_m2m_field_names:<EOL><INDENT>m2m_fields_to_commit.append(field)<EOL><DEDENT>else:<EOL><INDENT>real_update_fields.append(field)<EOL><DEDENT><DEDENT><DEDENT>super(ClusterableModel, self).save(update_fields=real_update_fields, **kwargs)<EOL>for relation in relations_to_commit:<EOL><INDENT>getattr(self, relation).commit()<EOL><DEDENT>for field in m2m_fields_to_commit:<EOL><INDENT>getattr(self, field).commit()<EOL><DEDENT>
Save the model and commit all child relations.