[Fixed]-Django models. FIltering objects through choosing parent in admin panel

1👍

You can do something like this, while choosing category you can make ajax call to get data from view, related to that category and whatever data you get in response, you can append it to product field.

Ajax call in js will be like this,

$.ajax({
        type: "GET",
        url: Urls['url-for-view'](),
        data: {
            'category': selected category value
        },
        success: function (msg) {
            //'get data from this msg and append it wherever you require'
        }
    });

You can return data from your view like this,

return HttpResponse(json.dumps(list_products))

Leave a comment