Skip to content

Getting the app_label information on post_migrate signalΒ #52

Open
@soundlake

Description

@soundlake

Code of Conduct

  • I agree to follow Django's Code of Conduct

Feature Description

post_migrate send the callback function an additional argument app_label that was passed to manage.py command line argument.

Problem

I would like to get the app_label via the arguments come through the callback for post_migrate. I'm aware that apps argument has the whole list of installed apps. What I would like to get is the specific app on which the migrate command was executed.

Let's say I have multiple apps with models in my project. I would like to execute some callback functions on post_migrate signal, but only when the specific app was run, for example, if I run python manage.py migrate or python manage.py migrate user, then the callback function in my user app would run. In this case, it doesn't matter if plan argument is empty or not. When I run python manage.py migrate blog which does not depend on user app, then the callback function does not run.

I can check when the specific app is in the plan argument. For example, some migration depends on the app's model. However, when the plan is empty, I don't have any manner to check if the command was executed on a specific app.

Request or proposal

request

Additional Details

No response

Implementation Suggestions

Adding an argument for emit_post_migrate_signal function, perhaps?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Idea

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions