> But latest() raises DoesNotExist error if sample does not have any 
> stages. Without using latest() and thus not
> having to write try/ catch, what is a good way to do this? Default values 
> for the list of stages and the status are [] and None, respectively.
>

I understand not wanting to write a try/catch block, because they are only 
meant to be for exceptional cases (since there is a lot of overhead 
associated with them).  However, using try/catch is appropriate in this 
situation, because from what I understand, it is exceptional for a sample 
to not have any stages.

You'll want to make sure that your data is in a runnable state, but as for 
the view I think that try/catch is your best bet.

-- 
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+unsubscr...@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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to