Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Removed bin/validate.py -- it wasn't being used

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1630 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 5c5bdddede5dd7498ab9fb23fc7dd8549ebb44ad 1 parent 26c8aab
Adrian Holovaty authored December 14, 2005

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

  1. 44  django/bin/validate.py
44  django/bin/validate.py
... ...
@@ -1,44 +0,0 @@
1  
-from django.core import meta
2  
-
3  
-def validate_app(app_label):
4  
-    mod = meta.get_app(app_label)
5  
-    for klass in mod._MODELS:
6  
-        try:
7  
-            validate_class(klass)
8  
-        except AssertionError, e:
9  
-            print e
10  
-
11  
-def validate_class(klass):
12  
-    opts = klass._meta
13  
-    # Fields.
14  
-    for f in opts.fields:
15  
-        if isinstance(f, meta.ManyToManyField):
16  
-            assert isinstance(f.rel, meta.ManyToMany), \
17  
-                "ManyToManyField %s should have 'rel' set to a ManyToMany instance." % f.name
18  
-    # Inline related objects.
19  
-    for related in opts.get_followed_related_objects():
20  
-        assert len([f for f in related.opts.fields if f.core]) > 0, \
21  
-            "At least one field in %s should have core=True, because it's being edited inline by %s." % \
22  
-            (related.opts.object_name, opts.object_name)
23  
-    # All related objects.
24  
-    related_apps_seen = []
25  
-    for related in opts.get_all_related_objects():
26  
-        if related.opts in related_apps_seen:
27  
-            assert related.field.rel.related_name is not None, \
28  
-                "Relationship in field %s.%s needs to set 'related_name' because more than one" \
29  
-                " %s object is referenced in %s." % \
30  
-                (related.opts.object_name, related.field.name, opts.object_name, rel_opts.object_name)
31  
-        related_apps_seen.append(related.opts)
32  
-    # Etc.
33  
-    if opts.admin is not None:
34  
-        assert opts.admin.ordering or opts.ordering, \
35  
-            "%s needs to set 'ordering' on either its 'admin' or its model," \
36  
-            " because it has 'admin' set." % opts.object_name
37  
-
38  
-if __name__ == "__main__":
39  
-    import sys
40  
-    try:
41  
-        validate_app(sys.argv[1])
42  
-    except IndexError:
43  
-        sys.stderr.write("Usage: %s [appname]\n" % __file__)
44  
-        sys.exit(1)

0 notes on commit 5c5bddd

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