List Info

Thread: Problem with ForeignKeys that references a huge table




Problem with ForeignKeys that references a huge table
user name
2007-12-20 09:13:19
Hello,

I will start with the code directly which will make it much
easier to
explain

class ProceedingsEditor( models.Model ):

                  contact	= models.ForeignKey( Contact )

The point here is that the contact table is a 10,000 or so
field so a
drop down list is none sense

Now in the admin model

class  ProceedingsEditorOptions( admin.ModelAdmin ):

    raw_id_fields = ( 'contact', )

Now Django will just display a normal text field with a
Magnifying
glass icon beside it. All is good till now

The problem is that Django displays the contact id which is
not useful
at all. Is there a way to reference for

example the contact__unicode() or something with a more
meaningful
name??

Thanks in advance

Cheers
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Problem with ForeignKeys that references a huge table
user name
2007-12-30 09:30:49
On Dec 20, 2007 10:13 AM, GodOfGeeks < hossamhassan85gmail.com">hossamhassan85gmail.com> wrote:

Hello,

I will start with the code directly which will make it much easier to
explain

class ProceedingsEditor( models.Model ):

                 contact       = models.ForeignKey( Contact )

The point here is that the contact table is a 10,000 or so field so a
drop down list is none sense

Now in the admin model

class  ProceedingsEditorOptions( admin.ModelAdmin ):

   raw_id_fields = ( 'contact', )

Now Django will just display a normal text field with a Magnifying
glass icon beside it. All is good till now

The problem is that Django displays the contact id which is not useful
at all. Is there a way to reference for

example the contact__unicode() or something with a more meaningful
name??

There's an open issue for this:

http://code.djangoproject.com/ticket/4641

with a simple patch that you can use until it gets applied and fixed officially.

Karen

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users"; group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to django-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )