[Answered ]-How to get a value of a model field in django actions?

2πŸ‘

βœ…

It looks like you are trying to get a property from the model CLASS. What you need to do is get the property from an instantiation of that model class.

model_obj = Entrada.objects.get(id=some_id)

def print_barcode(modeladmin, request, queryset):
    path_output = os.path.join(settings.MEDIA_ROOT, model_obj.serial)
    cmd = settings.BARCODE_COMMAND.format(model_obj.serial, path_output)
πŸ‘€J__

Leave a comment