def my_callback(field, **kwargs): if field.rel.raw_id_admin: return TextField() else: return field.formfield(**kwargs)
On 6 Лют, 11:36, sector119 <[EMAIL PROTECTED]> wrote: > Oh, sorry! I mean foreign key, not primary key :( > > On 6 Лют, 11:32, sector119 <[EMAIL PROTECTED]> wrote: > > > Hi ALL! > > > How can I check that model M has some primary key field with > > raw_id_admin value set to True? How can I access this option? I'm > > tired of looking for this option using dir() :) > > > P.S. I do not know name of the PK field. I try to substitute > > ChoiceField with TextField usinc formfield_callback in my form that > > was generated dynamicly with ModelForm! > > > Thanks! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---