Hi

Thanks for your help Melvyn and Daniel.I was not familiar with this 
pattern. Good to hear that there is nothing actually wrong with the code.

- np

On Saturday, 11 March 2017 19:03:54 UTC+2, Melvyn Sopacua wrote:
>
> On Saturday 11 March 2017 07:55:58 np wrote:
>
>  
>
> > being caught. However, I do not understand why should I just *suppress
>
> > *Exceptions/KeyErrors in the templates? I did not understand *why*
>
> > this exception is raised. If there is no such variable as 'is_popup',
>
> > shoudn't I just provide one? Forgive me for asking if the answer is
>
> > too trivial.
>
>  
>
> The admin reuses templates (and forms and views) for a popup window. It 
> does so for the "plus" and "edit" buttons for foreign relations. 
>
>  
>
> It is a common pattern to "define something is it applies" and it be 
> undefined if it doesn't. It's kind of a shortcut boolean that saves an 
> extra line in the code.
>
> Django template code tries to keep programming out of the template, so 
> undefined and false are for all intents and purposes identical in 
> comparisons.
>
>  
>
> The exception is logged, so that one is still able to determine why code 
> fails that you think shouldn't fail.
>
> -- 
>
> Melvyn Sopacua
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7bf8ebc7-f166-491a-8a67-10f94e3f4a37%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to