[Fixed]-What does deconstructible do in Python?

13👍

By using Google I managed to find that it is part of Django:

https://docs.djangoproject.com/en/stable/topics/migrations/#adding-a-deconstruct-method

As long as all of the arguments to your class’ constructor are themselves serializable, you can use the @deconstructible class decorator from django.utils.deconstruct to add the deconstruct() method

6👍

def deconstructible(*args, **kwargs):
    """
    Class decorator that allow the decorated class to be serialized
    by the migrations subsystem.

    Accepts an optional kwarg `path` to specify the import path.
    """

Leave a comment