I have a model and I have implemented soft delete in it. but while deleting from Django admin, it is deleting from the database. How will I bring soft delete in the Django admin also?
by soft delete what I meant is without deleting the data from the DB, a boolean-field "is_deleted" in the model is set to 1"
class Model_1(models.Model):
field_1 = models.CharField(max_length = 25)
.
.
is_active = models.booleanField(default=1)
is_deleted = models.booleanField(default = 0)
class modelForm_1(forms.ModelForm):
class Meta:
model = Model_1
exclude = ("field_1", "field_2", "field_3",)
class ModelAdmin_1(admin.ModelAdmin):
model = Model_1
list_display = ("jobid", "job_title", "position", "employer")
change_form_template = 'admin_panel/detail.html'
form = modelForm_1
admin.site.register(Model_1, ModelAdmin_1)