Sets the `extra` value on `InlineModelAdmin` to 0, so you just use the addition button
-instead of having any empty formsets.
+instead of having any empty formsets.
+### patch_model_admin(model, patch_function)
+Patch an installed ``ModelAdmin``. This includes unregistering, patching and then re-registering. You may pass in a model, or a string of the form `"app_label.ModelName"`, and a function that will take and patch a ``ModelAdmin`` class.
+If you create a new class based on the passed in class, then you may return it: that will then be used within the re-registration. If you simply patch the existing class, you can return nothing, and the patched original class will be used.
+ from admin_additions.patchers import patch_model_admin
+ def patcher_function(model_admin):
+ model_admin.form = MyClassyForm
+ return model_admin # optional: you may patch in-place
+ patch_model_admin(MyModel, patcher_function)
+### add_inlines(model, *inlines)
+A simple/common case of patching a ``ModelAdmin``: adding a new inline:
+ from django.contrib import admin
+ from admin_additions.patchers import add_inlines
+ class FooInline(admin.StackedInline):
+ add_inlines('bar.Bar', FooInline)
+You may pass multiple inlines.
+You may also pass in any combination of models or admin inlines: if a model is received, it will create a `StackedInline` for that model.