Comment (by claudep):
#18441 was a duplicate
--
Ticket URL: <https://code.djangoproject.com/ticket/13776#comment:8>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* stage: Design decision needed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/13776#comment:9>
* owner: nobody => elektrrrus
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/13776#comment:10>
* cc: mjumbewu (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/13776#comment:11>
* owner: elektrrrus => anubhav9042
--
Ticket URL: <https://code.djangoproject.com/ticket/13776#comment:12>
Comment (by anubhav9042):
Currently if blank=True and null is not True, ValueError is raised. The
check being in related.py #399 for ForeignKey.
a.) I think we can display a correct message depicting the problem that in
ForeignKey with null=True can only be left blank.
b.) We can stop the usage of blank=True with ForeignKey, because alone
without null=True defined it has no significance and give suitable error
message instead of raising an error. null=True alone works perfectly
Any opinions?
--
Ticket URL: <https://code.djangoproject.com/ticket/13776#comment:13>
* cc: anubhav9042@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/13776#comment:14>
Comment (by anubhav9042):
I hope to work on this ticket for GSoC 2014.
--
Ticket URL: <https://code.djangoproject.com/ticket/13776#comment:15>
Comment (by timo):
I think `blank=True` with `null=False` is acceptable. For example, you
might fill in the value of the `ForeignKey` in the object's `save()`
method.
--
Ticket URL: <https://code.djangoproject.com/ticket/13776#comment:16>
Comment (by anubhav9042):
Replying to [comment:16 timo]:
> I think `blank=True` with `null=False` is acceptable. For example, you
might fill in the value of the `ForeignKey` in the object's `save()`
method.
What about `is_valid`?
--
Ticket URL: <https://code.djangoproject.com/ticket/13776#comment:17>
Comment (by timo):
We should try to fix it so that an exception is not raised. As noted in
the django-users thread, the use-case worked in Django 1.0, but broke in
1.2.
--
Ticket URL: <https://code.djangoproject.com/ticket/13776#comment:18>
* has_patch: 0 => 1
* version: 1.2 => master
--
Ticket URL: <https://code.djangoproject.com/ticket/13776#comment:19>
Comment (by timo):
As discussed on IRC, the patch isn't what we want. There shouldn't be a
form error because the form is valid according to its specification.
--
Ticket URL: <https://code.djangoproject.com/ticket/13776#comment:20>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"45e049937d2564d11035827ca9a9221b86215e45"]:
{{{
#!CommitTicketReference repository=""
revision="45e049937d2564d11035827ca9a9221b86215e45"
Fixed #13776 -- Fixed ModelForm.is_valid() exception with non-nullable FK
and blank=True.
Thanks peterbe for the report.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/13776#comment:21>
Comment (by Claude Paroz <claude@…>):
In [changeset:"65a1055a36318ff4e21ffeb7c3dd62fa81892269" 65a1055]:
{{{
#!CommitTicketReference repository=""
revision="65a1055a36318ff4e21ffeb7c3dd62fa81892269"
Fixed #25431 -- Readded inline foreign keys to modelformset instances
Too much field exclusions in form's construct_instance() in _post_clean()
could lead to some unexpected missing ForeignKey values.
Fixes a regression from 45e049937. Refs #13776.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/13776#comment:22>
Comment (by Claude Paroz <claude@…>):
In [changeset:"158b0a28374054b1c3f94a9602b69f93fc980448" 158b0a28]:
{{{
#!CommitTicketReference repository=""
revision="158b0a28374054b1c3f94a9602b69f93fc980448"
[1.8.x] Fixed #25431 -- Readded inline foreign keys to modelformset
instances
Too much field exclusions in form's construct_instance() in _post_clean()
could lead to some unexpected missing ForeignKey values.
Fixes a regression from 45e049937. Refs #13776.
Backport of 65a1055a3 from master.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/13776#comment:23>