Code

Ticket #628: patch.diff

File patch.diff, 717 bytes (added by jkocherhans@…, 9 years ago)

this patch only writes a default docsting for a model class if you haven't defined one in your model

Line 
1Index: django/core/meta/__init__.py
2===================================================================
3--- django/core/meta/__init__.py        (revision 875)
4+++ django/core/meta/__init__.py        (working copy)
5@@ -563,7 +563,8 @@
6         new_class = type.__new__(cls, name, bases, attrs)
7 
8         # Give the class a docstring -- its definition.
9-        new_class.__doc__ = "%s.%s(%s)" % (opts.module_name, name, ", ".join([f.name for f in opts.fields]))
10+        if new_class.__doc__ is None:
11+            new_class.__doc__ = "%s.%s(%s)" % (opts.module_name, name, ", ".join([f.name for f in opts.fields]))
12 
13         # Create the standard, module-level API helper functions such
14         # as get_object() and get_list().