Created
July 20, 2012 02:38
-
-
Save yangyubo/3148316 to your computer and use it in GitHub Desktop.
Get object's full model name, formatted as "app_label.module_name"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# django tempatetag | |
# django version >= 1.4 is required | |
@register.assignment_tag | |
def get_full_modelname(object): | |
""" | |
usage: | |
{% get_full_modelname object as modelname_var %} | |
""" | |
opts = object._meta | |
return '%s.%s'%(opts.app_label, opts.module_name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment