def convert_all_videos(app_label, model_name, object_pk):
    """
    Automatically converts all videos of a given instance.
    """
    # get instance
    Model = apps.get_model(app_label=app_label, model_name=model_name)
    instance = Model.objects.get(pk=object_pk)

    # search for `VideoFields`
    fields = instance._meta.fields
    for field in fields:
        if isinstance(field, VideoField):
            if not getattr(instance, field.name):
                # ignore empty fields
                continue

            # trigger conversion
            fieldfile = getattr(instance, field.name)
            convert_video(fieldfile)
def convert_all_videos ( app_label , model_name , object_pk ) : Model = apps . get_model ( app_label = app_label , model_name = model_name ) instance = Model . objects . get ( pk = object_pk ) fields = instance . _meta . fields for field in fields : if isinstance ( field , VideoField ) : if not getattr ( instance , field . name ) : continue fieldfile = getattr ( instance , field . name ) convert_video ( fieldfile )
Automatically converts all videos of a given instance.