Opened 9 years ago

Closed 9 years ago

#3388 closed (invalid)

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

Reported by: anton@… Owned by: adrian
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: UI/UX:


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@… 9 years ago.
quick fix

Download all attachments as: .zip

Change History (5)

Changed 9 years ago by anton@…

quick fix

comment:1 Changed 9 years ago by anton@…

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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

comment:2 Changed 9 years ago by anton@…

Woops, sorry, i meant #3257

comment:3 Changed 9 years ago by adrian

  • Needs tests set
  • Triage Stage changed from Unreviewed to Accepted

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

comment:4 Changed 9 years ago by anton@…

  • Resolution set to invalid
  • Status changed from new to closed

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