﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
4214	Document how to update a foreign key in db-api	david@…	Jacob	"I am not sure of best place to highlight this in the documentation, but it cost me an hour to find out the hard way :) 

API reference to foreignkey fields appears to require appending _id to fieldname.

{{{
class Nlgroup(models.Model):
  o1object = models.ForeignKey('People', related_name='nlgroupo1object', null=True, blank=True, editable=False)
  givens = models.CharField(maxlength=25, verbose_name=""Givens"", blank= True, editable=False)
  def save(self): 
    if not self.id:
      p = People.objects.create(orgname=self.description)
# self.o1object is not saved into the o1object field
      self.o1object_id = p.id 
    super(Nlgroup, self).save() 

}}}"		closed	Documentation	dev		fixed			Accepted	1	0	0	0	0	0
