Lookup Fields

16 views
Skip to first unread message

Dean

unread,
Jul 5, 2014, 10:05:26 PM7/5/14
to django...@googlegroups.com

    LOOKUP_PEOPLE = (
    ('person1', 'person1'),
    ('person2', 'person2'),
    ('person3', 'person3'),
    )
    role_for_who = models.CharField('Role for', max_length=50, choices=LOOKUP_PEOPLE)

Thanks in advance for any help. I almost had it - I wish - but don't think django liked starting with an empty database.

When defining the models.py, rather than use a handtyped LOOKUP_PEOPLE (as above) I would like LOOKUP_PEOPLE to provide the choices from a list of forenames. How do I do that, when the forenames are in the same 'class People'?
(I understand I won't see these in the models.py file).

Thanks again.


Daniel Roseman

unread,
Jul 6, 2014, 10:14:30 PM7/6/14
to django...@googlegroups.com
Sounds like you want a ForeignKey to "self".
--
DR.

Dean

unread,
Jul 7, 2014, 1:26:17 AM7/7/14
to django...@googlegroups.com
Spot on DR - thanks - for pointing me in the right direction :-)


 

 
Reply all
Reply to author
Forward
0 new messages