I got the solution by myself. I just used pathon reflection:
getattr(m, field.name) just returned the value of the field.name and field.name is the name of the ForeignKey. On 18 Mai, 11:31, mwebs <[EMAIL PROTECTED]> wrote: > Hi, > > I have the following problem: > > ++++++++++++code++++++++++++++ > > lookUpDict = {sequence:new_sequence, field.name : m.????} > > ++++++++++++++++++++++++++++++++++ > > In this context +field+ is the ForeignKey-Field of a modelObject. With > field.name I get the name of the FK-Field, e.g 'category'. Now I need > to assign the value of the ForeignKey-Field of my modelObject . E.g. > m.category. > > The problem is that 'category' should not be hard-coded but dynamic. > So how can I get the FK? Is there something like the .pk property? > > Does anybody has an idea how to do that? > > Thank you for your help! > Toni --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---