I am doing the following:
model._meta.get_field('g').get_internal_type
Which returns the following:
<bound method URLField.get_internal_type of <django.db.models.fields.URLField: g>>
I only want the know that this field is "URLField" . How do I extract that from this output?
Note: I am doing this so that I can do validation on the fields. For example if a url , I want to check if it is well formed.
The answer is to call the method instead:
You can do this:
or If you want to use String instead of working only with UrlField
or
You Can also use equal '==' instead of 'is'
You can Check Offical Documentation for more information about
If you were doing this:
You could not possibly get that as a result.
Instead, you are doing this:
Which, as explained here, does not call the method, it just refers to the method as a bound method object. The return value is not part of that bound method object, it's created by the method when the method is called. So, you have to call it. So you need the parentheses.