Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

magic-removal: Modified model validation error messages to suggest a …

…way of fixing name clash problems.

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2472 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit fd3de3e29ed0298d94e075d6af14f81be03e0178 1 parent 5e6d82a
Russell Keith-Magee authored March 02, 2006

Showing 1 changed file with 9 additions and 9 deletions. Show diff stats Hide diff stats

  1. 18  django/core/management.py
18  django/core/management.py
@@ -847,21 +847,21 @@ def get_validation_errors(outfile, app=None):
847 847
             if f.rel:
848 848
                 rel_opts = f.rel.to._meta
849 849
                 if f.rel.to not in models.get_models():
850  
-                     e.add(opts, "'%s' relates to uninstalled model %s" % (f.name, rel_opts.object_name))
  850
+                     e.add(opts, "'%s' has relation with uninstalled model %s" % (f.name, rel_opts.object_name))
851 851
 
852 852
                 rel_name = RelatedObject(f.rel.to, cls, f).get_accessor_name()
853 853
                 for r in rel_opts.fields:
854 854
                     if r.name == rel_name:
855  
-                        e.add(opts, "'%s' accessor name '%s.%s' clashes with another field" % (f.name, rel_opts.object_name, r.name))
  855
+                        e.add(opts, "'%s' accessor name '%s.%s' clashes with another field. Add a related_name argument to the definition for '%s'." % (f.name, rel_opts.object_name, r.name, f.name))
856 856
                 for r in rel_opts.many_to_many:
857 857
                     if r.name == rel_name:
858  
-                        e.add(opts, "'%s' accessor name '%s.%s' clashes with a m2m field" % (f.name, rel_opts.object_name, r.name))
  858
+                        e.add(opts, "'%s' accessor name '%s.%s' clashes with a m2m field. Add a related_name argument to the definition for '%s'." % (f.name, rel_opts.object_name, r.name, f.name))
859 859
                 for r in rel_opts.get_all_related_many_to_many_objects():
860 860
                     if r.get_accessor_name() == rel_name:
861  
-                        e.add(opts, "'%s' accessor name '%s.%s' clashes with a related m2m field" % (f.name, rel_opts.object_name, r.get_accessor_name()))
  861
+                        e.add(opts, "'%s' accessor name '%s.%s' clashes with a related m2m field. Add a related_name argument to the definition for '%s'." % (f.name, rel_opts.object_name, r.get_accessor_name(), f.name))
862 862
                 for r in rel_opts.get_all_related_objects():
863 863
                     if r.get_accessor_name() == rel_name and r.field is not f:
864  
-                        e.add(opts, "'%s' accessor name '%s.%s' clashes with a related field" % (f.name, rel_opts.object_name, r.get_accessor_name()))
  864
+                        e.add(opts, "'%s' accessor name '%s.%s' clashes with another related field. Add a related_name argument to the definition for '%s'." % (f.name, rel_opts.object_name, r.get_accessor_name(), f.name))
865 865
 
866 866
         for i, f in enumerate(opts.many_to_many):
867 867
             # Check to see if the related m2m field will clash with any
@@ -873,16 +873,16 @@ def get_validation_errors(outfile, app=None):
873 873
             rel_name = RelatedObject(f.rel.to, cls, f).get_accessor_name()
874 874
             for r in rel_opts.fields:
875 875
                 if r.name == rel_name:
876  
-                    e.add(opts, "'%s' m2m accessor name '%s.%s' clashes with another field" % (f.name, rel_opts.object_name, r.name))
  876
+                    e.add(opts, "'%s' m2m accessor name '%s.%s' clashes with another field. Add a related_name argument to the definition for '%s'." % (f.name, rel_opts.object_name, r.name, f.name))
877 877
             for r in rel_opts.many_to_many:
878 878
                 if r.name == rel_name:
879  
-                    e.add(opts, "'%s' m2m accessor name '%s.%s' clashes with a m2m field" % (f.name, rel_opts.object_name, r.name))
  879
+                    e.add(opts, "'%s' m2m accessor name '%s.%s' clashes with a m2m field. Add a related_name argument to the definition for '%s'." % (f.name, rel_opts.object_name, r.name, f.name))
880 880
             for r in rel_opts.get_all_related_many_to_many_objects():
881 881
                 if r.get_accessor_name() == rel_name and r.field is not f:
882  
-                    e.add(opts, "'%s' m2m accessor name '%s.%s' clashes with a related m2m field" % (f.name, rel_opts.object_name, r.get_accessor_name()))
  882
+                    e.add(opts, "'%s' m2m accessor name '%s.%s' clashes with a related m2m field. Add a related_name argument to the definition for '%s'." % (f.name, rel_opts.object_name, r.get_accessor_name(), f.name))
883 883
             for r in rel_opts.get_all_related_objects():
884 884
                 if r.get_accessor_name() == rel_name:
885  
-                    e.add(opts, "'%s' m2m accessor name '%s.%s' clashes with a related field" % (f.name, rel_opts.object_name, r.get_accessor_name()))
  885
+                    e.add(opts, "'%s' m2m accessor name '%s.%s' clashes with another related field. Add a related_name argument to the definition for '%s'." % (f.name, rel_opts.object_name, r.get_accessor_name(), f.name))
886 886
 
887 887
         # Check admin attribute.
888 888
         if opts.admin is not None:

0 notes on commit fd3de3e

Please sign in to comment.
Something went wrong with that request. Please try again.