[Answer]-Django model add data to model only if boolean field is true

1👍

Override ModelAdmin.save_model() method:

class JobsAdmin(admin.ModelAdmin):

    def save_model(self, request, obj, form, change):
        if not obj.current_job:
            obj.current_jobtitle = ''
            obj.current_jobcompany = ''
        obj.save()

Leave a comment