create_permissions
Creates default permissions for all models in a given application configuration, ensuring that required content types are generated beforehand. This function performs bulk database inserts and may output status messages to the console based on the verbosity level.
def create_permissions(
app_config: AppConfig,
verbosity: int = 2,
interactive: boolean = True,
using: str = DEFAULT_DB_ALIAS,
apps: Apps = global_apps,
**kwargs: dict
) - > null
Creates default permissions for all models in a given application configuration. This function ensures that both ContentTypes and their associated Permission objects exist in the database, typically called during the post-migration signal.
Parameters
| Name | Type | Description |
|---|---|---|
| app_config | AppConfig | The configuration object for the application whose permissions should be generated. |
| verbosity | int = 2 | Controls the amount of notification output printed to the console; levels 2 and higher list each added permission. |
| interactive | boolean = True | Determines if the function may prompt the user for input during the creation process. |
| using | str = DEFAULT_DB_ALIAS | The database alias identifying which database connection to use for permission lookups and creation. |
| apps | Apps = global_apps | The registry containing the installed application and model definitions. |
| **kwargs | dict | Additional keyword arguments passed through to the underlying content type creation logic. |
Returns
| Type | Description |
|---|---|
null | Nothing is returned; permissions are persisted directly to the database via bulk creation. |