Re: calling self.errors in a form in a formset breaks deletion

2020-06-19 Thread David Smith
Hi Carles, Hope you are well. You mentioned you are using crispy-forms. :-) Have you seen this part of the docs, it allows you to update forms 'on the go'. I've not really played with this but it sounds similar to what you need? https://django-crispy-forms.readthedocs.io/en/latest/dynamic_layo

Re: calling self.errors in a form in a formset breaks deletion

2020-06-19 Thread Carlton Gibson
Hi Carles. Supported/unsupported isn't always clear cut... if you bend it far it far enough maybe it's just undefined what the behaviour is. Certainly, adding fields based on whether the field data is itself if invalid is going to lead into sticky territory. When you add FormSets to the mix a

Re: calling self.errors in a form in a formset breaks deletion

2020-06-19 Thread Carles Pina i Estany
Hi, On Jun/19/2020, Carlton Gibson wrote: > Bon dia Carles. I'm very impressed! :-) > I'm inclined to say that calling self.errors in __init__ is at least *holding > it wrong*. :-) it almost worked! (the only known issue was for the BaseForm not deleting the model of my ModelForm... for wh

Re: calling self.errors in a form in a formset breaks deletion

2020-06-19 Thread Carlton Gibson
Bon dia Carles. I'm inclined to say that calling self.errors in __init__ is at least *holding it wrong*. I'm not sure what if anything we might do about that. DRF's serializers have all kinds of "you have to call is_valid() before accessing .data" type assertions, but they only catch the o

calling self.errors in a form in a formset breaks deletion

2020-06-19 Thread Carles Pina i Estany
Hi, Yesterday I found that calling self.errors in the constructor of a Form that is in an InlineFormSet (or any formset I guess): the "delete" of a form doesn't work anymore. I wonder if this is a bug in Django (for this case, if a new bug is needed, I'm happy to open it... or be referred to an