﻿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
561	Relate Objects to a choice of objects	Boffbowsh	Adrian Holovaty	"I have a object that needs to be related to one of a number objects. I propose two new field types called ForeignChoice and ManyToManyChoice (name suggestions welcomed, because I think they suck to be honest)

Proposed syntax:
{{{
from django.core import meta

COMPONENT_TYPES = (
    TextInput,
    ColourChoice
)	

class Component(meta.Model):
    name = meta.CharField(max_length=32)
    input = meta.ForeignChoice(COMPONENT_TYPES)

class TextInput(meta.Model):
    text = meta.TextField()

class ColourChoice(meta.Model):
    name = meta.SlugField(primary_key=True)
    rgb = meta.CharField(max_length=7)
}}}

This would create a appname_components table with the id and name fields as you'd expect, but also input_class and input_id fields. input_class would be one of 'TextInput' or 'ColourChoice', and input_id would refer to the PK in that class.

I'll start work on a patch soon, but ideas and comments would be very welcome"	enhancement	closed	Metasystem		normal	duplicate			Unreviewed	0	0	0	0	0	0
