Re: ModelForm and ForeignKeys

2009-08-25 Thread Alexandru-Emil Lupu
an ideea: build a custom Model Form for Character, and after that define CharacterHome Model Form. class CharacterForm(forms.ModelForm): class Meta: model = Character exclude = ('some', 'fields','here', 'that', 'you', 'do', 'not', 'want', 'to', 'display' ) class CharacterHomeF

Re: ModelForm and ForeignKeys

2009-08-25 Thread goobee
Hi Léon, it's not that basic. Picking up your example, I define a Form based on CharacterHome. Then I show 1 entry from CharacterHome; the field 'character' is shown as a MultipleChoiceField where ALL entries from Character are listed. But I need only the one particular record that ist referenced

Re: ModelForm and ForeignKeys

2009-08-25 Thread goobee
Hi Léon, it's not that basic. Picking up your example, I define a Form based on CharacterHome. Then I show 1 entry from CharacterHome; the field 'character' is shown as a MultipleChoiceField where ALL entries from Character are listed. But I need only the one particular record that ist referenced

Re: ModelForm and ForeignKeys

2009-08-24 Thread Léon Dignòn
Basically you have to link them with a foreign key. I hope this fits your needs with the legacy table. class Character(models.Model): guid = models.IntegerField(primary_key=True) name = models.CharField() … class CharacterHome(models.Model): character = models.ForeignKey(Character

Re: ModelForm and ForeignKeys

2009-08-24 Thread Léon Dignòn
goobee, I am not sure, if I understand you. You have a person with a name, let's say "Max Mustermann". You want to show the ModelForm participant for this particular person? Is this correct? On Aug 24, 9:14 am, goobee wrote: > thanks Léon > > but I need name and firstname from the referenced tab

Re: ModelForm and ForeignKeys

2009-08-24 Thread goobee
thanks Léon but I need name and firstname from the referenced table 'person', but only from ONE person; the person I read from 'participant'. goobee --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" gro

Re: ModelForm and ForeignKeys

2009-08-22 Thread Ryan Bales
I have experienced this same issue, and that link didn't really help. I am trying to hook into a legacy database using "inspectdb", and I can't index the tables. class Character(models.Model): guid = models.IntegerField(primary_key=True) name = models.CharField() ... ... class

Re: ModelForm and ForeignKeys

2009-08-22 Thread Léon Dignòn
http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#using-a-subset-of-fields-on-the-form Good luck! -ld On Aug 21, 3:49 pm, goobee wrote: > hi there > > I'm in dire need of a good idea. django drives me crazy with its > foreignkey-resolver. > > class person(models.Model): >     name

ModelForm and ForeignKeys

2009-08-21 Thread goobee
hi there I'm in dire need of a good idea. django drives me crazy with its foreignkey-resolver. class person(models.Model): name ... firstname class participant(models.Model): group .. person(foreignkey(person)) funk ... I want to show 'participant