1👍
✅
I’m not sure what the goal of accessing user.__dict__
is, but if it is to check the model fields you can do something like this:
u = staff.profile.user
model_field_names = map(lambda f:f.name, u._meta.fields)
changes_moderated_dict.update(dict(
[(i, getattr(u, i, None))
for i in changed_data
if i in model_field_names]))
Source:stackexchange.com