drop-in replacement for admin module foreign key relation UI

56 views
Skip to first unread message

Jani Kajala

unread,
Feb 16, 2015, 6:03:05 PM2/16/15
to django...@googlegroups.com
Hi all,

I have tons of objects referenced by ForeignKey in Django Admin module UI, and I would like to replace it with something more optimal, e.g. auto-fill input box or something.

My model looks something like this:

class SoapCall(models.Model):
    customer = models.ForeignKey(Customer, null=True, blank=True)
    created = models.DateTimeField(default=now)
    wsdl = models.CharField(max_length=255)
    func = models.CharField(max_length=63)
    request = models.TextField()
    response = models.TextField()

Now, this works great, but if I have 100000 Customer objects it's not very nice to generate one huge <select><option>... element for every page load.

There seems to be many possible plugins/implementations for this, but I was just wondering if anyone would have up-to-date recommendations in this mailing list. I'm on Python 3.4.2 and Django 1.7.4.

Thanks beforehand. :) 


Br,
Jani

P.S. <3 Django

Jani Tiainen

unread,
Feb 17, 2015, 2:20:22 AM2/17/15
to django...@googlegroups.com
I would start with built-in implementation, a.k.a. rawid_id_fields <https://docs.djangoproject.com/en/1.7/ref/contrib/admin/#django.contrib.admin.ModelAdmin.raw_id_fields>


--
Jani Tiainen

Jani Kajala

unread,
Feb 17, 2015, 12:45:13 PM2/17/15
to django...@googlegroups.com
That's perfect, thanks

Derek

unread,
Feb 18, 2015, 8:58:54 AM2/18/15
to django...@googlegroups.com
I think https://pypi.python.org/pypi/django-autocomplete-light is good, quick and stable.  It has "heritage" (been around and battle-tested) and provides the features that are key.  (And supports Django 1.7, Python3).

muin

unread,
Jul 14, 2016, 7:31:45 AM7/14/16
to Django users
when I use this method, I can only use its id, So how can it show related model's field which has been defined in __str__
Reply all
Reply to author
Forward
0 new messages