Andrew Godwin avatar Andrew Godwin committed 489fdc0

Update custom fields docs

Comments (0)

Files changed (1)

docs/customfields.rst

 (such as ``max_length``) are defined on the specific fields they apply to
 (in this case, ``CharField``).
 
-If your custom field inherits from a core Django field, and doesn't add any new
+If your custom field inherits from a core Django field, or another field for
+whcih there are already introspection rules, and it doesn't add any new
 attributes, then you probably won't have to add any rules for it, as it will
-inherit all those from its parents.
+inherit all those from its parents. In this case, a call like this should work::
 
-However, South first checks that it has explicitly been told a class is
-introspectable first; even though it will probably have rules defined (since it
-inherits from Field, at least), there's no way to guarantee that it knows about
-all of the possible rules until it has been told so.
+ from south.modelsinspector import add_introspection_rules
+ add_introspection_rules([], ["^myapp\.stuff\.fields\.SomeNewField"])
+
+Note that you must always specify a field as allowed, even if specifies no
+new rules of its own - the alternative is that South must presume all fields
+without any new rules specified only have the options of their parents, which
+is wrong some of the time.
 
 Thus, there are two stages to adding support for your custom field to South;
 firstly, adding some rules for the new arguments it introduces (or possibly
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.