@register.filter<EOL>def get_content_type(obj, field_name=False):
content_type = ContentType.objects.get_for_model(obj)<EOL>if field_name:<EOL><INDENT>return getattr(content_type, field_name, '<STR_LIT>')<EOL><DEDENT>return content_type<EOL>
Returns the content type of an object.

:param obj: A model instance.
:param field_name: Field of the object to return.