Opened 12 years ago

Closed 12 years ago

#3388 closed (invalid)

[patch] newforms: fails with DoesNotExist exception when form contains ForeignKey field

Reported by: anton@… Owned by: Adrian Holovaty
Component: Forms Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no


Hello everyone

SVN version of newforms contains a bug with merging Jeff Hilyard's patch: when one does with a form contained ForeignKey field, it fails with DoesNotExists exception.

Patch to fix it is attached.

Attachments (1)

quick-fix.patch (499 bytes) - added by anton@… 12 years ago.
quick fix

Download all attachments as: .zip

Change History (5)

Changed 12 years ago by anton@…

Attachment: quick-fix.patch added

quick fix

comment:1 Changed 12 years ago by anton@…

Has patch: set

P.S. I've found it by comparing #3263 patch and svn code

comment:2 Changed 12 years ago by anton@…

Woops, sorry, i meant #3257

comment:3 Changed 12 years ago by Adrian Holovaty

Needs tests: set
Triage Stage: UnreviewedAccepted

Could you write a patch to the unit tests in tests/modeltests/model_forms/

comment:4 Changed 12 years ago by anton@…

Resolution: invalid
Status: newclosed

Adrian, sorry, it seems to be my mistake.
#3257 required clean_data to contain ForeignKey object (for example Writer object for Article, if we speak about unittests in tests/modeltests/model_forms/, your current changes require it to contain ForeignKey object's id, so my code, based on #3257, failed and I sent this patch to fix it.
Is there any page that could explain your vision of future features to not make such mistakes again ? For example, I sent the patch #3370 (mysql should set 'charset': 'utf8' to connection attributes), with this patch my app works ok but 8 tests fail (db returns unicode), without it all tests passed but in my app i see a mess of national charset and unicode strings on one page.

Note: See TracTickets for help on using tickets.
Back to Top