This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
# AutoComplete for ForeignKey and ManyToManyField
uses same syntax as the search for django-admin

* query.js (
* query.autocomplete.js

## Example

use a fairly simple
class Type (models.Model):
title = models.CharField()

class Celebrity(models.Model):
name = models.CharField()

class Film(models.Model):
type = models.ForeignKey( Type )
director= models.ManyToManyField( Celebrity, related_name="director")
actor = models.ManyToManyField( Celebrity, related_name="actor")

in m2m field need to specify related_name

from apps.autocomplete.widgets import *

class FilmAdmin(AutocompleteModelAdmin):
related_search_fields = {

'type': ('title',),
'actor': ('^name',),
'director': ('^name',),
} Film, FilmAdmin )

"related_search_fields" parameter is used to specify on what fields you want to search 'actor' and 'director' ties are the names given in "related_name" query syntax is similar to [searching in admin panel](

I use the " 'actor': ('^name',) " operator ^ means the beginning of the field. and eventually will be formed about the substitution request form For example, if related_search_fieldsis set to ('^name',') and a user searches for john lennon, Django will do the equivalent of this SQL WHERE clause:

WHERE name ILIKE 'john%' AND name ILIKE 'lennon%'

Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django_autocomplete_foreignkey-0.0.1.tar.gz (11.7 kB) Copy SHA256 Checksum SHA256 Source Oct 9, 2013

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting