From b9c2b3e83fefdc96be4a381586cf7984ad8d6a75 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Fri, 3 Feb 2006 20:01:58 +0000 Subject: [PATCH] magic-removal: Changed model validator not to check for 'singular' on ManyToManyFields, because that's not going to be used anymore. git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2243 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/core/management.py | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/django/core/management.py b/django/core/management.py index d283c39aba..b5cee58bbd 100644 --- a/django/core/management.py +++ b/django/core/management.py @@ -1,7 +1,7 @@ # Django management-related functions, including "CREATE TABLE" generation and # development-server initialization. -import django +import django from django.core.exceptions import ImproperlyConfigured import os, re, sys, textwrap from optparse import OptionParser @@ -810,7 +810,7 @@ def get_validation_errors(outfile): "Validates all installed models. Writes errors, if any, to outfile. Returns number of errors." from django.db import models from django.db.models.fields.related import RelatedObject - + e = ModelErrorCollection(outfile) for cls in models.get_models(): opts = cls._meta @@ -860,14 +860,8 @@ def get_validation_errors(outfile): e.add(opts, "'%s.%s' related field: Clashes with related m2m field '%s.%s'" % (opts.object_name, f.name, rel_opts.object_name, rel_name)) elif rel_name in [r.OLD_get_accessor_name() for r in rel_opts.get_all_related_objects() if r.field is not f]: e.add(opts, "'%s.%s' related field: Clashes with related field on '%s.%s'" % (opts.object_name, f.name, rel_opts.object_name, rel_name)) - - # Check for multiple ManyToManyFields to the same object, and - # verify "singular" is set in that case. - for i, f in enumerate(opts.many_to_many): - for previous_f in opts.many_to_many[:i]: - if f.rel.to._meta == previous_f.rel.to._meta and f.rel.singular == previous_f.rel.singular: - e.add(opts, 'The "%s" field requires a "singular" parameter, because the %s model has more than one ManyToManyField to the same model (%s).' % (f.name, opts.object_name, previous_f.rel.to._meta.object_name)) + for i, f in enumerate(opts.many_to_many): # Check to see if the related m2m field will clash with any # existing fields, m2m fields, m2m related objects or related objects if f.rel: @@ -1060,11 +1054,11 @@ DEFAULT_ACTION_MAPPING = { } NO_SQL_TRANSACTION = ( - 'adminindex', - 'createcachetable', - 'dbcheck', - 'install', - 'installperms', + 'adminindex', + 'createcachetable', + 'dbcheck', + 'install', + 'installperms', 'reset', 'sqlindexes' )