Hi,
I want to make the following tiny modification to the Django framework. I want it to create a "deleted" field for each model I create, plus of course I want it to be checked as deleted when I delete it from the admin page instead of being physically deleted, and I dont want these records checked as deleted to be listed.
I'm new to Django, I'm seeing if I can do what I want to do with it easily. I need this change because it's the way we currently work.
I admit that I can be doing something stupid by plain ignorance of the framework, plus there can be easiest ways to do what I want to do.
So far these are the changes I have made, I would like to understand how the whole Django framewok works inside but I'm so far from that, is there any documentation online which explains clearly how the inside framework parts/files/modules/classes work together, the specific role of each one, etc
In the base.py file, in the modelbase class, below this code
for obj_name, obj in attrs.items():
new_class.add_to_class(obj_name, obj)
I added
from django.db import models
new_class.add_to_class('deleted', models.BooleanField())
so now when it creates a model it adds the "deleted" field to it.
In the base.py file, in the save method, I changed what it was there for
self.deleted = True
self.save()
so now it check as deleted a record instead of physically delete it.
Now what I want is those records not to be listed, but I have no idea how or where to do it. Any help is appreciated