4

Currently I am working on old project developed in python 2.7 & django 1.9.13 & during development I have found below kind of code.

from django.contrib.contenttypes.models import ContentType
model_type = ContentType.objects.get(app_label=app_name, model=model_name)
model_type.model_class().objects.filter(id=10).update(**{'emp_comment': 'hello'})

I have read about ContentType & know how it works but still not have much clear ideas but what I am not able to figure out is **{'emp_comment': 'hello'}.

I have search online for such kind of syntax but not able to find so anyone have idea how above code works ?

Moon
  • 4,014
  • 3
  • 30
  • 66

0 Answers0