This never happened to me and I find it very strange. Maybe it's a bug or 
maybe it's the intended behaviour, but I find it REALLY strange.

Consider a widget which, for some reason, raises an exception:

class CoolWidget(AdminTextareaWidget):
    def render(self, name, value, attrs={}):
        WRONG()
        return super(JsonSchemaWidget, self).render(name, value, attrs)

The widget is included in an admin form like:

class PizzaForm(forms.ModelForm):
    class Meta:
        model = Pizza
        exclude = []
        widgets = {'toppings': CoolWidget}


class PizzaAdmin(ModelAdmin):
    form = TemplateForm

Now, if DEBUG is True, trying to open the relative pizza change or add form 
will result in:

NameError: name 'WRONG' is not defined

When DEBUG to False what I see is really strange:

I get an empty change/add form!

<https://lh3.googleusercontent.com/-k2-DznqIO2E/VuKq3sx74OI/AAAAAAAABlo/AFAvi1vQ3EI6o2mshUBCLQgd8vpvvF5VQ/s1600/widget-problem-django.png>


Now suppose that the condition that raises the exception happens only on a 
remote server

which has DEBUG=False. The exception happens because the configuration of a 
django project

has not been updated correctly yet.


Instead of failing loud, it will fail silently, leaving an empty add/change 
form.


Is it the intended behaviour? Or a bug?

I guess it is related due to the fact that template errors are silenced.

Federico

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" 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 https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/e5f6999e-b94b-4ecc-a14c-02c01c789f09%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to