How to raise exception in model?
I have some custom functions in model classes which processes some data, and add custom attribute to the model. Thing is, I do not know how could I raise an exception if this functions that are accessed when the template is generated (the error seems to be only silent, so it will process the template further but gives NO ERROR )
-- In the template
{{ entry.state }}
In the model:
@property
def state(self):
somedict = {'a': 111}
try:
print somedict['b']
except Exception as e:
FATAL_ERROR
What should I put in the place of fatal_error so that the template processing should stop immediatelly, or gives some exception to the render function ?
Thanks
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home