﻿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
359	Simplified assignment and lookup for related fields	garthk@…	Adrian Holovaty	"Further to #122, I'd love to see a simpler syntax for direct assignment and reference of objects in related tables. It'd eliminate the last big separation (in my mind, at least) between how people work with normal Python objects and how they need to work Django database-backed objects. All you'd have left is {{{.save()}}}, which I'm all for keeping. 

{{{
from django.core import meta

class Person(meta.Model):
    name = meta.CharField(maxlength=200)
    
class CourtCase(meta.Model):
    plaintiff = meta.ForeignKey(Person)
    defendant = meta.ForeignKey(Person)

me = persons.get_object(name__exact=""garthk"")
you = persons.get_object(name__exact=""hugo-"")
case = courtcases.CourtCase()
case.defendant = me
case.plaintiff = you
case.save()
print case.defendant.name
}}}

We'd also want to retain support for {{case.defendant_id = me.id}} for those who tend to think more in terms of the database structures than the Python structures. I'm definitely in the latter category, but I know plenty of people in the former. "	defect	closed	contrib.admin		normal	duplicate			Accepted	0	0	0	0	0	0
