override model save method

As long as it’s doing what you need it to do, you’re good.

I have a problem and solved with:

class HistoryAdmin(admin.ModelAdmin):
(return model :History)

def get_queryset(self, request, *args, **kwargs):

    return JigLedger.objects.all()  

  (# return  model : JigLedger)

def save_model(self, request, obj, form, change):
# JigLedger ×
# History √
(save model: History)

super(HistoryAdmin, self).save_model(request, obj, form, change)
( The current obj is JigLedger )

I Using the save_model method in admin.ModelAdmin, where obj is the model instance, returns a new model instance jigLdeger because get_queryset is used, but I want to override save_model to implement the save function, I want to change the save_model parameter obj to model instance history. How to solve this problem? thank you

If you’re having an issue with which you are looking for assistance, I suggest you open a new topic with these details. This topic is marked as “solved” and is not likely to attract attention.

Also, when you’re posting code, enclose the code between lines of three backtick - ` characters. This means you’ll put a line of ``` before and after the code, on lines by themselves. This prevents the forum software from messing up the code.