Re: how to capture the exception
sorry,
missed while copying
def save(self):
self.name=self.name.strip()
if (not self.pk):
if Article.objects.filter(name__iexact=self.name).count()!
=0:
raise Exception('article exists..')
this causes 500 error,and causes the traceback displayed on
browser..how can I prevent this crash and give the user some useful
warning?
.harry
(sorry for the noob qn)
On Feb 25, 12:57 am, Shawn Milochik <sh...@milochik.com> wrote:
> Note:
>
> As written, your code will never let you edit an existing Article. You should add an if statement to check whether 'self.pk' is true also.
>
> Shawn
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home