Tuesday, March 28, 2017

Re: Django signup problem Urgent

On Monday 27 March 2017 20:19:11 Babatunde Akinyanmi wrote:

> Hello Idowu.

> You were supposed to include your stack trace so that there can be a

> proper diagnosis of the problem. Now we can only guess.

>

> I guess you are submitting your form with the `description` field

> empty because your defined it with `blank=True` in your models.py.

 

Wrong diagnosis. You would not get a "field is required" message, but "this field cannot be null" (which comes from the model layer, not the form layer).

 

The problem is two-fold:

1) You're trying to do everything yourself that's already abstracted. Use at minimum generic.FormView

2) The image field: it is required and you're not passing request.FILES to the form.

 

And maybe a third: encoding type of the form should be set correctly.

--

Melvyn Sopacua

No comments:

Post a Comment