Hello all, I've had some troubles with default callables in FKs and tracked it down to one of my templates tags which returns a model class. I'm not sure if this is considered kosher or not so feel free comment on that too.
In my template I have a something like: {{ my_project_lookup_class.classname.get_verbose_name }} my_project_lookup_class.classname will the return the django model class, and the template engine apparently checks if the class is callable, then calls it which will try to instanciate a new object with no arguments. In that specific case it fails because of missing default values but my intent was to call a classmethod anyway. I worked around it by using the do_not_call_in_templates flag on my models, because I'll never intend to call a constructor from a template anyway. I've found a ticket corresponding to this issue. https://code.djangoproject.com/ticket/16307 and here's the discussion regarding the do_not_call_in_templates flag: https://code.djangoproject.com/ticket/15791 So my question is, would it make sense to make do_not_call_in_templates default to True for django's Model class ? This would potentially break stuff if people used that trick to actually instantiate objects, I have no idea whether this is a common use case or not. -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/4d367c99-06e0-4812-ad5a-38defbc05ec8%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.