I have a function like this...which helps me with code re-writing when calling out a query
def user_profile(self, **kwargs):
default_fields = {
'is_deleted': False,
'is_staff': False,
'is_active': False
}
kwargs.update(default_fields)
return Profile.objects.filter(**kwargs)
but let's say, if I don't want to add another new parameter into the function and I want to override the is_staff
field sometimes *maybe out of 20 queries only 1 need is_staff: True
.
Is an easy way?
I have thought of adding another parameter into the function to detect if True / False
something like that which would work.
But I wonder if there's an even easier faster way to do this?
Thanks in advance for any suggestions.