PK6@_Q+V+V(django-autocomplete-light-0.8/quick.html Quick start — django-autocomplete-light 0.7 documentation

Quick start

The purpose of this documentation is to get you started as fast as possible, because your time matters and you probably have other things to worry about.

Quick install

Install the package:

pip install django-autocomplete-light
# or the development version
pip install -e git+git://github.com/yourlabs/django-autocomplete-light.git#egg=django-autocomplete-light

Add to INSTALLED_APPS: ‘autocomplete_light’

Add to urls:

url(r'autocomplete/', include('autocomplete_light.urls')),

Add before admin.autodiscover():

import autocomplete_light
autocomplete_light.autodiscover()

At this point, we’re going to assume that you have django.contrib.staticfiles working. This means that static files are automatically served with runserver, and that you have to run collectstatic when using another server (fastcgi, uwsgi, and whatnot). If you don’t use django.contrib.staticfiles, then you’re on your own to manage staticfiles.

This is an example of how you could load the javascript:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
{% include 'autocomplete_light/static.html' %}

Quick admin integration

For AutocompleteWidget to be enabled in the admin, you should create your own admin/base_site.html template as demonstrated in test_project/templates/admin/base_site.html:

{% extends "admin/base.html" %}
{% load i18n %}

{% block footer %}
    {{ block.super }}

    <script src="{{ STATIC_URL }}jquery.js" type="text/javascript"></script>
    {% include 'autocomplete_light/static.html' %}
    {% comment %}
    Load additionnal script or style dependencies here. For instance, the
    double country/city autocomplete widget requires the countrycity deck
    bootstrap so we'll load it. But you don't need this one if you don't use
    the countrycity widget of the cities_light app.
    {% endcomment %}
    <script src="{{ STATIC_URL }}cities_light/autocomplete_light.js" type="text/javascript"></script>
{% endblock %}

Create yourapp/autocomplete_light_registry.py, assuming “Author” has a “full_name” CharField:

import autocomplete_light

from models import Author

autocomplete_light.register(Author, search_field='full_name')

See more about the channel registry in Registry.

But still, the default implementation of query_filter() is pretty trivial, you might want to customize how it will filter the queryset. See more about customizing channels in Channels basics.

Anyway, finish by setting BookAdmin.form in yourapp/admin.py:

from django.contrib import admin

import autocomplete_light

from models import Book

class BookAdmin(admin.ModelAdmin):
    # use an autocomplete for Author
    form = autocomplete_light.modelform_factory(Book)
admin.site.register(Book, BookAdmin)

Quick form integration

AutocompleteWidget is usable on ModelChoiceField and ModelMultipleChoiceField.

class autocomplete_light.widgets.AutocompleteWidget(channel_name, *args, **kwargs)[source]

Widget suitable for ModelChoiceField and ModelMultipleChoiceField.

Example usage:

from django import forms

import autocomplete_light

from models import Author

class AuthorsForm(forms.Form):
    lead_author = forms.ModelChoiceField(Author.objects.all(), widget=
        autocomplete_light.AutocompleteWidget(
            'AuthorChannel', max_items=1))

    contributors = forms.ModelMultipleChoiceField(Author.objects.all(),
        widget=autocomplete_light.AutocompleteWidget('AuthorChannel'))

AutocompleteWidget constructor decorates SelectMultiple constructor

Arguments: channel_name – the name of the channel that this widget should use.

Keyword arguments are passed to javascript via data attributes of the autocomplete wrapper element:

max_items
The number of items that this autocomplete allows. If set to 0, then it allows any number of selected items like a multiple select, well suited for ManyToMany relations or any kind of ModelMultipleChoiceField. If set to 3 for example, then it will only allow 3 selected items. It should be set to 1 if the widget is for a ModelChoiceField or ForeignKey, in that case it would be like a normal select. Default is 0.
min_characters
The minimum number of characters before the autocomplete box shows up. If set to 2 for example, then the autocomplete box will show up when the input receives the second character, for example ‘ae’. If set to 0, then the autocomplete box will show up as soon as the input is focused, even if it’s empty, behaving like a normal select. Default is 0.
bootstrap
The name of the bootstrap kind. By default, deck.js will only initialize decks for wrappers that have data-bootstrap=”normal”. If you want to implement your own bootstrapping logic in javascript, then you set bootstrap to anything that is not “normal”. By default, its value is copied from channel.bootstrap.
placeholder
The initial value of the autocomplete input field. It can be something like ‘type your search here’. By default, it is copied from channel.placeholder.
payload
A dict of data that will be exported to JSON, and parsed into the Deck instance in javascript. It allows to pass variables from Python to Javascript.

Project Versions

Table Of Contents

Previous topic

django-autocomplete-light demo

Next topic

Making a global navigation autocomplete

This Page

PK6@y)(django-autocomplete-light-0.8/forms.html Integration with forms — django-autocomplete-light 0.7 documentation

Integration with forms

The purpose of this documentation is to describe every element in a chronological manner. Because you want to know everything about this app and hack like crazy.

It is complementary with the quick documentation.

Django startup

Registry

The registry module provides tools to maintain a registry of channels.

The first thing that should happen when django starts is registration of channels. It should happen first, because channels are required for autocomplete widgets. And autocomplete widgets are required for forms. And forms are required for ModelAdmin.

It looks like this:

  • in yourapp/autocomplete_light_registry.py, register your channels with autocomplete_light.register(),
  • in urls.py, do autocomplete_light.autodiscover() before admin.autodiscover().
ChannelRegistry
Subclass of Python’s dict type with registration/unregistration methods.
registry
Instance of ChannelRegistry.
register
Proxy registry.register.
autodiscover
Find channels and fill registry.
class autocomplete_light.registry.ChannelRegistry[source]

Dict with some shortcuts to handle a registry of channels.

channel_for_model(model)[source]

Return the channel class for a given model.

register(*args, **kwargs)[source]

Proxy registry.register_model_channel() or registry.register_channel() if there is no apparent model for the channel.

Example usages:

# Will create and register SomeModelChannel, if SomeChannel.model
# is None (which is the case by default):
autocomplete_light.register(SomeModel)

# Same but using SomeChannel as base:
autocomplete_light.register(SomeModel, SomeChannel)

# Register a channel without model, ensure that SomeChannel.model
# is None (which is the default):
autocomplete_light.register(SomeChannel)

# As of 0.5, you may also pass attributes*, ie.:
autocomplete_light.register(SomeModel, search_field='search_names',
    result_template='somemodel_result.html')

You may pass attributes via kwargs, only if the registry creates a type:

  • if no channel class is passed,
  • or if the channel class has no model attribute,
  • and if the channel classs is not generic
register_channel(channel)[source]

Register a channel without model, like a generic channel.

register_model_channel(model, channel=None, channel_name=None, **kwargs)[source]

Add a model to the registry, optionnaly with a given channel class.

model
The model class to register.
channel
The channel class to register the model with, default to ChannelBase.
channel_name
Register channel under channel_name, default is ModelNameChannel.
kwargs
Extra attributes to set to the channel class, if created by this method.

Three cases are possible:

  • specify model class and ModelNameChannel will be generated extending ChannelBase, with attribute model=model
  • specify a model and a channel class that does not have a model attribute, and a ModelNameChannel will be generated, with attribute model=model
  • specify a channel class with a model attribute, and the channel is directly registered

To keep things simple, the name of a channel is it’s class name, which is usually generated. In case of conflicts, you may override the default channel name with the channel_name keyword argument.

unregister(name)[source]

Unregister a channel.

autocomplete_light.registry.register(*args, **kwargs)[source]

Proxy registry.register

autocomplete_light.registry.autodiscover()[source]

Check all apps in INSTALLED_APPS for stuff related to autocomplete_light.

For each app, autodiscover imports app.autocomplete_light_registry if available, resulting in execution of register() statements in that module, filling registry.

Consider a standard app called ‘cities_light’ with such a structure:

cities_light/
    __init__.py
    models.py
    urls.py
    views.py
    autocomplete_light_registry.py

With such a autocomplete_light_registry.py:

from models import City, Country
import autocomplete_light
autocomplete_light.register(City)
autocomplete_light.register(Country)

When autodiscover() imports cities_light.autocomplete_light_registry, both CityChannel and CountryChannel will be registered. For details on how these channel classes are generated, read the documentation of ChannelRegistry.register.

Channels basics

Example

django-cities-light ships the working example.

API

The channel.base module provides a channel class which you can extend to make your own channel. It also serves as default channel class.

class autocomplete_light.channel.base.ChannelBase[source]

A basic implementation of a channel, which should fit most use cases.

Attributes:

model
The model class this channel serves. If None, a new class will be created in registry.register, and the model attribute will be set in that subclass. So you probably don’t need to worry about it, just know that it’s there for you to use.
result_template
The template to use in result_as_html method, to render a single autocomplete suggestion. By default, it is autocomplete_light/channelname/result.html or autocomplete_light/result.html.
autocomplete_template
The template to use in render_autocomplete method, to render the autocomplete box. By default, it is autocomplete_light/channelname/autocomplete.html or autocomplete_light/autocomplete.html.
search_field
The name of the field that the default implementation of query_filter uses. Default is ‘name’.
limit_results
The number of results that this channel should return. For example, if query_filter returns 50 results and that limit_results is 20, then the first 20 of 50 results will be rendered. Default is 20.
bootstrap
The name of the bootstrap kind. By default, deck.js will only initialize decks for wrappers that have data-bootstrap=”normal”. If you want to implement your own bootstrapping logic in javascript, then you set bootstrap to anything that is not “normal”. Default is ‘normal’.
placeholder
The initial text in the autocomplete text input.

Set result_template and autocomplete_template if necessary.

are_valid(values)[source]

Return True if the values are valid.

By default, expect values to be a list of object ids, return True if all the ids are found in the queryset.

as_dict()[source]

Return a dict of variables for this channel, it is used by javascript.

get_absolute_url()[source]

Return the absolute url for this channel, using autocomplete_light_channel url

get_queryset()[source]

Return a queryset for the channel model.

get_results(values=None)[source]

Return an iterable of result to display in the autocomplete box.

By default, it will:

  • call self.get_queryset(),
  • call values_filter() if values is not None,
  • call query_filter() if self.request is set,
  • call order_results(),
  • return a slice from offset 0 to self.limit_results.
init_for_request(request, *args, **kwargs)[source]

Set self.request, self.args and self.kwargs, useful in query_filter.

order_results(results)[source]

Return the result list after ordering.

By default, it expects results to be a queryset and order it by search_field.

query_filter(results)[source]

Filter results using the request.

By default this will expect results to be a queryset, and will filter it with self.search_field + ‘__icontains’=self.request[‘q’].

render_autocomplete()[source]

Render the autocomplete suggestion box.

By default, render self.autocomplete_template with the channel in the context.

result_as_html(result, extra_context=None)[source]

Return the html representation of a result for display in the deck and autocomplete box.

By default, render result_template with channel and result in the context.

result_as_value(result)[source]

Return the value that should be set to the widget field for a result.

By default, return result.pk.

values_filter(results, values)[source]

Filter results based on a list of values.

By default this will expect values to be an iterable of model ids, and results to be a queryset. Thus, it will return a queryset where pks are in values.

Forms

Example

A simple example from test_project:

from django import forms

import autocomplete_light
from cities_light.models import City
from cities_light.contrib.autocomplete_light_widgets import \
    CityAutocompleteWidget

from models import Address
from generic_form_example import TaggedItemForm


class AddressForm(forms.ModelForm):
    city = forms.ModelChoiceField(City.objects.all(),
        widget=CityAutocompleteWidget('CityChannel', max_items=1))

    class Meta:
        model = Address
        widgets = autocomplete_light.get_widgets_dict(Address,
            autocomplete_exclude='city')

API

A couple of helper functions to help enabling AutocompleteWidget in ModelForms.

autocomplete_light.forms.get_widgets_dict(model, autocomplete_exclude=None)[source]

Return a dict of field_name: widget_instance for model that is compatible with Django.

autocomplete_exclude
the list of model field names to ignore

Inspect the model’s field and many to many fields, calls registry.channel_for_model to get the channel for the related model. If a channel is returned, then an AutocompleteWidget will be spawned using this channel.

The dict is usable by ModelForm.Meta.widgets. In django 1.4, with modelform_factory too.

autocomplete_light.forms.modelform_factory(model, autocomplete_exclude=None, **kwargs)[source]

Wraps around Django’s django_modelform_factory, using get_widgets_dict.

Basically, it will use the dict returned by get_widgets_dict in order and pass it to django’s modelform_factory, and return the resulting modelform.

Page rendering

It is important to load jQuery first, and then autocomplete_light and application specific javascript, it can look like this:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
{% include 'autocomplete_light/static.html' %}

However, autocomplete_light/static.html also includes “remote.js” which is required only by remote channels. If you don’t need it, you could either load the static dependencies directly in your template, or override autocomplete_light/static.html:

<script type="text/javascript" src="{{ STATIC_URL }}autocomplete_light/autocomplete.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}autocomplete_light/deck.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}autocomplete_light/remote.js"></script>
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}autocomplete_light/style.css" />

Or, if you only want to make a global navigation autocomplete, you only need:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script src="{{ STATIC_URL }}autocomplete_light/autocomplete.js" type="text/javascript"></script>

For AutocompleteWidget to be enabled in the admin, you should create your own admin/base_site.html template as demonstrated in test_project/templates/admin/base_site.html:

{% extends "admin/base.html" %}
{% load i18n %}

{% block footer %}
    {{ block.super }}

    <script src="{{ STATIC_URL }}jquery.js" type="text/javascript"></script>
    {% include 'autocomplete_light/static.html' %}
    {% comment %}
    Load additionnal script or style dependencies here. For instance, the
    double country/city autocomplete widget requires the countrycity deck
    bootstrap so we'll load it. But you don't need this one if you don't use
    the countrycity widget of the cities_light app.
    {% endcomment %}
    <script src="{{ STATIC_URL }}cities_light/autocomplete_light.js" type="text/javascript"></script>
{% endblock %}

Widget in action

Widget definition

The first thing that happens is the definition of an AutocompleteWidget in a form.

class autocomplete_light.widgets.AutocompleteWidget(channel_name, *args, **kwargs)[source]

Widget suitable for ModelChoiceField and ModelMultipleChoiceField.

Example usage:

from django import forms

import autocomplete_light

from models import Author

class AuthorsForm(forms.Form):
    lead_author = forms.ModelChoiceField(Author.objects.all(), widget=
        autocomplete_light.AutocompleteWidget(
            'AuthorChannel', max_items=1))

    contributors = forms.ModelMultipleChoiceField(Author.objects.all(),
        widget=autocomplete_light.AutocompleteWidget('AuthorChannel'))

AutocompleteWidget constructor decorates SelectMultiple constructor

Arguments: channel_name – the name of the channel that this widget should use.

Keyword arguments are passed to javascript via data attributes of the autocomplete wrapper element:

max_items
The number of items that this autocomplete allows. If set to 0, then it allows any number of selected items like a multiple select, well suited for ManyToMany relations or any kind of ModelMultipleChoiceField. If set to 3 for example, then it will only allow 3 selected items. It should be set to 1 if the widget is for a ModelChoiceField or ForeignKey, in that case it would be like a normal select. Default is 0.
min_characters
The minimum number of characters before the autocomplete box shows up. If set to 2 for example, then the autocomplete box will show up when the input receives the second character, for example ‘ae’. If set to 0, then the autocomplete box will show up as soon as the input is focused, even if it’s empty, behaving like a normal select. Default is 0.
bootstrap
The name of the bootstrap kind. By default, deck.js will only initialize decks for wrappers that have data-bootstrap=”normal”. If you want to implement your own bootstrapping logic in javascript, then you set bootstrap to anything that is not “normal”. By default, its value is copied from channel.bootstrap.
placeholder
The initial value of the autocomplete input field. It can be something like ‘type your search here’. By default, it is copied from channel.placeholder.
payload
A dict of data that will be exported to JSON, and parsed into the Deck instance in javascript. It allows to pass variables from Python to Javascript.
render(name, value, attrs=None)[source]

Render the autocomplete widget.

It will try two templates, like django admin: - autocomplete_light/channelname/widget.html - autocomplete_light/widget.html

Note that it will not pass ‘value’ to the template, because ‘value’ might be a list of model ids in the case of ModelMultipleChoiceField, or a model id in the case of ModelChoiceField. To keep things simple, it will just pass a list, ‘values’, to the template context.

value_from_datadict(data, files, name)[source]

Route to Select if max_items is 1, else route to SelectMultiple

Widget rendering

This is what the default widget template looks like:

{% load i18n %}
{% load autocomplete_light_tags %}

{% comment %}
The outer element is called the 'widget wrapper'. It contains some data
attributes to communicate between Python and JavaScript. And of course, it
wraps around everything the widget needs.
{% endcomment %}
<span class="autocomplete_light_widget {{ name }}" id="{{ widget.html_id }}_wrapper" data-bootstrap="{{ widget.bootstrap }}">
    
    {# a deck that should contain the list of selected options #}
    <ul id="{{ html_id }}_deck" class="deck" >
        {% for result in results %}
            {{ result|autocomplete_light_result_as_html:channel }}
        {% endfor %}
    </ul>

    {# a text input, that is the 'autocomplete input' #}
    <input type="text" class="autocomplete" name="{{ name }}_autocomplete" id="{{ widget.html_id }}_text" value="" {{ extra_attrs }} />
    
    {# a hidden select, that contains the actual selected values #}
    <select style="display:none" class="valueSelect" name="{{ name }}" id="{{ widget.html_id }}" {% if widget.max_items != 1 %}multiple="multiple"{% endif %}>
        {% for value in values %}
            <option value="{{ value }}" selected="selected">{{ value }}</option>
        {% endfor %}
    </select>

    {# a hidden textarea that contains some json about the widget #}
    <textarea class="json_payload" style="display:none">
        {{ json_payload }}
    </textarea>
    
    {# a hidden div that serves as template for the 'remove from deck' button #}
    <div style="display:none" class="remove">
        {# This will be appended to results on the deck, it's the remove button #}
        X
    </div>

    <ul style="display:none" class="add_template">
        {% comment %}
        the contained element will be used to render options that are added to the select 
        via javascript, for example in django admin with the + sign

        The text of the option will be inserted in the html of this tag
        {% endcomment %}
        <li class="result">
        </li>
    </ul>
</span>

Javascript initialization

deck.js initializes all widgets that have bootstrap=’normal’ (the default), as you can see:

$('.autocomplete_light_widget[data-bootstrap=normal]').each(function() {
    $(this).yourlabs_deck();
});

If you want to initialize the deck yourself, set the widget or channel bootstrap to something else, say ‘yourinit’. Then, add to yourapp/static/yourapp/autocomplete_light.js something like:

$('.autocomplete_light_widget[data-bootstrap=yourinit]').each(function() {
    $(this).yourlabs_deck({
        getValue: function(result) {
            // your own logic to get the value from an html result
            return ...;
        }
    });
});

yourapp/static/yourapp/autocomplete_light.js will be automatically collected by by autodiscover, and the script tag generated by {% autocomplete_light_static %}.

In django-cities-light source, you can see a more interresting example where two autocompletes depend on each other.

You should take a look at the code of autocomplete.js and deck.js, as it lets you override everything.

One interresting note is that the plugins (yourlabs_autocomplete and yourlabs_deck) hold a registry. Which means that:

  • calling someElement.yourlabs_deck() will instanciate a deck with the passed overrides
  • calling someElement.yourlabs_deck() again will return the deck instance for someElement

Javascript cron

deck.js includes a javascript function that is executed every two seconds. It checks each widget’s hidden select for a value that is not in the deck, and adds it to the deck if any.

This is useful for example, when an item was added to the hidden select via the ‘+’ button in django admin. But if you create items yourself in javascript and add them to the select it would work too.

Javascript events

When the autocomplete input is focused, autocomplete.js checks if there are enought caracters in the input to display an autocomplete box. If minCharacters is 0, then it would open even if the input is empty, like a normal select box.

If the autocomplete box is empty, it will fetch the channel view. The channel view will delegate the rendering of the autocomplete box to the actual channel. So that you can override anything you want directly in the channel.

class autocomplete_light.views.ChannelView(**kwargs)[source]

Simple view that routes the request to the appropriate channel.

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

get(request, *args, **kwargs)[source]

Return an HttpResponse with the return value of channel.render_autocomplete().

This view is called by the autocomplete script, it is expected to return the rendered autocomplete box contents.

To do so, it gets the channel class from the registry, given the url keyword argument channel, that should be the channel name.

Then, it instanciates the channel with no argument as usual, and calls channel.init_for_request, passing all arguments it recieved.

Finnaly, it makes an HttpResponse with the result of channel.render_autocomplete(). The javascript will use that to fill the autocomplete suggestion box.

post(request, *args, **kwargs)[source]

Just proxy channel.post().

This is the key to communication between the channel and the widget in javascript. You can use it to create results and such.

ChannelBase.render_autocomplete()[source]

Render the autocomplete suggestion box.

By default, render self.autocomplete_template with the channel in the context.

ChannelBase.result_as_html(result, extra_context=None)[source]

Return the html representation of a result for display in the deck and autocomplete box.

By default, render result_template with channel and result in the context.

Then, autocomplete.js recognizes options with a selector. By default, it is ‘.result’. This means that any element with the ‘.result’ class in the autocomplete box is considered as an option.

When an option is selected, deck.js calls it’s method getValue() and adds this value to the hidden select. Also, it will copy the result html to the deck.

When an option is removed from the deck, deck.js also removes it from the hidden select.

This is the default HTML template for the autocomplete:

{% load autocomplete_light_tags %}

<ul>
{% for result in channel.get_results %}
    {{ result|autocomplete_light_result_as_html:channel }}
{% endfor %}
</ul>

This is the default HTML template for results:

<li class="result" data-value="{{ value|safe }}">
    {{ result }} {{ extra_html|safe }}
</li>
PK6@a`-`-.django-autocomplete-light-0.8/py-modindex.html Python Module Index — django-autocomplete-light 0.7 documentation

Project Versions

PK6@"ܣ^^(django-autocomplete-light-0.8/index.html Welcome to django-autocomplete-light’s documentation! — django-autocomplete-light 0.7 documentation

Welcome to django-autocomplete-light’s documentation!

Features

This app fills all your ajax autocomplete needs:

README

https://secure.travis-ci.org/yourlabs/django-autocomplete-light.png?branch=master

This is a simple alternative to django-ajax-selects.

Requirements

  • Python 2.7
  • jQuery 1.7+
  • Django 1.4+ (at least for autocomplete_light.forms helpers)
  • django.contrib.staticfiles or you’re on your own

Resources

You could subscribe to the mailing list ask questions or just be informed of package updates.

Demo

See test_project/README

Javascript API

Work in progress:

When things go wrong

If you don’t know how to debug, you should learn to use:

Firebug javascript debugger
Open the script tab, select a script, click on the left of the code to place a breakpoint
Ipdb python debugger
Install ipdb with pip, and place in your python code: import ipdb; ipdb.set_trace()

If you are able to do that, then you are a professional, enjoy autocomplete_light !!!

If you need help, open an issue on the github issues page.

But make sure you’ve read how to report bugs effectively and how to ask smart questions.

Also, don’t hesitate to do pull requests !

Indices and tables

Project Versions

Table Of Contents

Next topic

django-autocomplete-light demo

This Page

PK6@" 77,django-autocomplete-light-0.8/searchindex.jsSearch.setIndex({objects:{"autocomplete_light.channel.generic.GenericChannelBase":{are_valid:[3,2,1,""],get_results:[3,2,1,""],order_results:[3,2,1,""],values_filter:[3,2,1,""],result_as_value:[3,2,1,""]},"autocomplete_light.registry.ChannelRegistry":{unregister:[5,2,1,""],register_channel:[5,2,1,""],channel_for_model:[5,2,1,""],register:[5,2,1,""],register_model_channel:[5,2,1,""]},"autocomplete_light.channel.base.ChannelBase":{get_results:[5,2,1,""],are_valid:[5,2,1,""],values_filter:[5,2,1,""],get_queryset:[5,2,1,""],as_dict:[5,2,1,""],query_filter:[5,2,1,""],result_as_value:[5,2,1,""],init_for_request:[5,2,1,""],result_as_html:[5,2,1,""],render_autocomplete:[5,2,1,""],order_results:[5,2,1,""],get_absolute_url:[5,2,1,""]},"autocomplete_light.channel.remote":{RemoteChannelBase:[1,1,1,""]},"autocomplete_light.views.ChannelView":{post:[5,2,1,""],get:[5,2,1,""]},"autocomplete_light.widgets.AutocompleteWidget":{value_from_datadict:[5,2,1,""],render:[5,2,1,""]},autocomplete_light:{widgets:[5,0,1,""],generic:[3,0,1,""],registry:[5,0,1,""],forms:[5,0,1,""]},"autocomplete_light.contrib.generic_m2m":{GenericManyToMany:[3,1,1,""],GenericModelForm:[3,1,1,""]},"autocomplete_light.generic.GenericForeignKeyField":{prepare_value:[3,2,1,""],to_python:[3,2,1,""]},"autocomplete_light.widgets":{AutocompleteWidget:[5,1,1,""]},"autocomplete_light.channel":{generic:[3,0,1,""],base:[5,0,1,""],remote:[1,0,1,""]},"autocomplete_light.views":{ChannelView:[5,1,1,""]},"autocomplete_light.registry":{autodiscover:[5,3,1,""],ChannelRegistry:[5,1,1,""],register:[5,3,1,""]},"autocomplete_light.forms":{get_widgets_dict:[5,3,1,""],modelform_factory:[5,3,1,""]},"autocomplete_light.channel.base":{ChannelBase:[5,1,1,""]},"autocomplete_light.generic.GenericModelForm":{save:[3,2,1,""]},"autocomplete_light.generic":{GenericModelForm:[3,1,1,""],GenericForeignKeyField:[3,1,1,""]},"autocomplete_light.contrib.generic_m2m.GenericModelForm":{generic_m2m_fields:[3,2,1,""],save:[3,2,1,""],save_m2m:[3,2,1,""]},"autocomplete_light.channel.generic":{GenericChannelBase:[3,1,1,""]},"autocomplete_light.contrib":{generic_m2m:[3,0,1,""]},"autocomplete_light.channel.remote.RemoteChannelBase":{fetch_result:[1,2,1,""],get_results:[1,2,1,""],model_for_source_url:[1,2,1,""],get_source_url_data:[1,2,1,""],result_as_value:[1,2,1,""],get_remote_results:[1,2,1,""],get_source_url:[1,2,1,""],post:[1,2,1,""],fetch:[1,2,1,""],result_as_dict:[1,2,1,""]}},terms:{represent:[5,1],all:[0,1,3,4,5,6,8],code:[3,0,1,8,5],set_trac:0,genericmanytomani:[3,0],global:[5,0,8],dollar:3,focus:[5,6],generic_m2m:3,runserv:[6,4],get_source_url:1,follow:[3,8,1],attemp:2,yourapp:[5,6],middl:8,depend:[0,3,4,5,6,7,8],name__icontain:[3,8],m2m:[3,0,4],sorri:[3,8],register_channel:5,specif:[5,8,1],send:1,autocomplete_light_env:4,under:5,remotecitychannel:1,register_model_channel:5,sourc:[3,4,1,6,5],everi:[5,8,1],string:3,extra_attr:5,autocomplete_light_result_as_html:5,fals:[3,8,1],account:2,fat:8,artwork:8,veri:[0,1,8],appar:5,generic_m2m_exampl:3,genericchannelbas:[3,0],contenttyp:3,"_wrapper":5,button:5,list:[5,0,1,2,8],iter:5,"try":[5,0,4],item:[5,6,1],sane:0,betspir:[0,8],quick:[5,0,6],div:[5,8],refer:[3,4],sign:5,cron:[5,0],second:[5,6],street:3,design:[0,8],pass:[5,6,1],result_templ:[3,5,1],click:[0,8],append:5,compat:[5,4],index:0,what:[3,4,8,5],hide:8,power:0,lead_author:[5,6],fine:8,abl:[0,8,4],find:[3,5,1,8],current:1,version:[6,4],channel:[0,1,3,4,5,6],"new":5,remotechannelbas:1,method:[3,0,1,8,5],whatev:8,redirect:8,widget:[0,1,2,3,4,5,6,7],full:[0,1],get_widgets_dict:[3,5,2],gener:[3,0,8,5,4],here:[3,5,7,6,8],satisfi:0,shouldn:8,let:[5,0],mincharact:5,address:[3,4,5],along:1,vertic:8,sinc:3,valu:[3,5,1,8,6],box:[5,6,1],citychannel:5,get_result:[3,5,1],somemodel_result:5,test_project:[0,3,4,5,6,7],behav:[5,6],social:1,action:[5,0,8],implement:[5,0,1,6],whatnot:6,via:[5,4,1,6],extra:[5,1],search:[5,0,6,8],modul:[5,0],remotechanneldeck:1,ask:0,api:[3,0,1,5,4],instal:[0,1,3,4,6,8],total:[3,8],redo:4,select:[0,1,3,4,5,6,8],encapsul:0,from:[0,1,3,4,5,6,8],describ:[5,1],usa:4,commun:5,distinct:8,doubl:[5,4,7,6],regist:[3,5,1,6],first_name__icontain:8,next:8,few:[0,4],live:[4,1],call:[3,5,1,8],min_charact:[5,6],taken:2,dict:[5,6,1,2],tag:[5,8],type:[1,3,5,6,7,8],manytomani:[5,6],fastcgi:6,more:[5,6,1,8],sudo:4,afford:3,readm:[0,4],relat:[3,0,1,6,5],error_messag:3,site:[3,6],img:8,templat:[5,0,7,6,8],git:[6,0,4],hold:5,content_typ:3,fetch_result:1,none:[3,5,1,8],work:[0,1,2,4,5,6,8],main_autocomplet:8,chronolog:[5,1],optionnali:5,can:[0,3,4,5,6,8],learn:0,purpos:[5,6,1],fetch:[5,1],def:[3,8],overrid:[3,0,1,5],sqlite:4,autocomplete_exclud:5,registr:5,accept:2,crazi:5,minimum:[5,6],tab:0,contribut:4,cours:[3,5,1,8],multipl:[3,5,6],rather:[3,1],anoth:[6,4,1],song:1,write:3,how:[5,0,6,8,4],modelnamechannel:5,sever:[4,1],subdirectori:4,instead:1,csv:3,simpl:[3,0,1,8,5],css:5,updat:[0,8,4],model_for_source_url:1,resourc:0,haven:8,max:1,clone:4,"__icontain":5,usabl:[5,6],duplic:3,befor:[5,0,6],wrong:0,"_text":5,mai:[5,8,2],suck:0,street__icontain:3,demonstr:[1,4,5,6,7,8],github:[6,0,4],footer:[5,6,7],caract:5,light:[0,1,2,3,4,5,6],bootstrap:[5,4,7,1,6],correspond:1,element:[5,6,1],issu:[3,0],receiv:[5,6],maintain:[3,0,5],allow:[5,6,1,2],egg:[6,4],classs:5,modelmultiplechoicefield:[5,0,6],help:[5,0],deck:[5,0,7,1,6],over:3,becaus:[3,5,1,6],valueselect:5,yourlab:[6,4],help_text:3,hell:3,still:6,style:[5,6,7,8],outer:5,render:[5,0,1,8],fit:5,funni:0,fix:3,djangorestframework:1,cities_light:[5,4,7,1,6],authorsform:[5,6],hidden:[5,1],might:[5,0,1,6],search_bloc:8,them:5,good:8,"return":[3,5,1,8],python:[5,0,6,4],pollut:4,safe:5,as_dict:5,somemodel:5,json_payload:5,django_modelform_factori:5,channelbas:[3,5],magic:8,now:4,channelview:[5,1],name:[3,4,6,8,5],anyth:[5,6],tran:8,getvalu:[5,1],prepare_valu:3,html_id:5,each:[3,0,1,8,5],debug:0,found:[5,8],autocomplete_light_tag:5,limit:[3,1],gui:3,mean:[5,0,6,8],query_filt:[3,5,6],hard:8,idea:0,ensur:5,realli:[3,8],contributor:[5,6],meta:[3,5,2],"static":[5,6,7],expect:[5,1],project_specif:8,recogn:5,happen:[5,8],somemodelchannel:5,event:[5,0,8],special:8,out:[3,8,1],variabl:[5,6,1],network:1,base_sit:[5,6,7],open:[5,0,8,4],defaultvalu:8,urlencod:8,search_field:[5,6],content:[3,5],interrest:[3,4,5],suitabl:[5,6],rel:5,modelform:[3,5,2],uwsgi:6,franc:4,after:[3,5,1],proxi:[5,1],navig:[5,0,8],advanc:[0,1,4],extra_html:5,differ:1,standard:5,reason:[3,4],base:[3,4,5,6,7,8],usual:5,releas:4,"_autocomplet":5,values_filt:[3,5],care:3,reusabl:8,wai:[0,8],argument:[5,6,1,2],dunno:8,could:[3,0,6,8,5],put:8,static_url:[5,6,7,8],keep:5,filter:[3,4,6,8,5],thing:[5,0,6,8],length:8,enforc:3,place:0,charfield:[3,6],think:8,urlconf:5,first:[5,4,8],channel_nam:[5,6],directli:5,template_nam:8,onc:[4,8],number:[5,6,1],yourself:5,alreadi:[3,4,8],done:[3,8],wrapper:[5,6],installed_app:[3,5,6],fantast:3,payload:[5,6,1],given:[3,5,1],workaround:[0,2],script:[5,0,7,6,8],are_valid:[3,5],data:[5,6,1],search_nam:5,system:4,least:0,citi:[5,4,7,1,6],max_length:3,master:4,too:[5,4,2],statement:5,ton:8,conveni:[3,8],consol:4,option:[5,8],travi:0,tool:5,copi:[3,5,6],specifi:5,selector:[5,8],show_hidden_initi:3,pars:[5,6,1],modelgroupadmin:3,rst:4,exactli:0,than:[3,1],serv:[5,6,1],enjoi:[0,8],kind:[3,0,6,8,5],bookadmin:6,keyword:[5,6],bloat:8,provid:[5,0,2],remov:5,structur:5,enought:5,project:[4,1,8],matter:[6,8],bind:8,other:[0,1,4,5,6,8],initi:[3,0,6,5],sai:5,arg:[3,5,1,6],queryset:[3,5,6],ani:[3,0,6,8,5],packag:[6,0,4],milion:3,authorchannel:[5,6],manner:5,have:[1,3,4,5,6,8],tabl:0,need:[0,1,4,5,6,7,8],django:[0,1,2,3,4,5,6,8],autodiscov:[5,6],lib:[5,6,8],min:[5,6,8],self:[3,5,1],object_id:3,client:0,note:[3,4,1,2,5],also:[3,0,8,5,4],contact:[3,4,8],read:[5,0,8,4],take:[5,1],indic:0,get_absolute_url:[5,8],singl:5,even:[3,5,6],sure:[0,4],unless:4,thi:[0,1,2,3,4,5,6,7,8],normal:[3,5,6,8],object:[0,1,3,5,6,8],deleg:5,most:[3,5],pari:4,breakpoint:0,america:4,"class":[0,1,2,3,5,6,8],collectstat:6,don:[0,4,5,6,7,8],textarea:[5,1],url:[5,4,1,8,6],hardcod:1,order:[3,5,1],craziest:0,link:[5,8],left:[3,0],show:[5,6],text:[5,6,7,1,8],elif:3,hack:[5,0],autocomplete_light_restframework:1,trivial:6,anywai:6,involv:1,absolut:5,onli:[1,3,4,5,6,8],locat:8,execut:5,pretti:6,activ:4,state:4,autocomplete_light_channel:5,suppos:1,result_as_valu:[3,5,1],folder:[4,1],extra_context:[5,8],local:[3,4,1],taggeditemform:[3,5],parsejson:1,get:[1,2,3,5,6,8],between:5,pypi:0,soon:[5,6],googleapi:[5,6,8],"import":[0,1,3,4,5,6,8],report:0,channel_for_model:5,requir:[0,3,4,5,6,7],attr:[5,8],rtfd:0,enabl:[5,6,7],artist:8,possibl:[5,0,6],channelnam:5,yield:3,remot:[5,0,1,4],somestr:8,stuff:5,integr:[5,0,6],contain:[3,5,1,8],where:[3,5,1,8],view:[5,0,1,8],respond:1,admintool:4,set:[3,5,1,6],art:8,init_for_request:5,startup:[5,0],placehold:[5,6],displai:[5,1],see:[3,0,6,5,4],bare:3,result:[3,0,1,5,4],respons:1,yourlabs_deck:[5,1],charact:[5,6],best:0,page:[5,0,8],jqueri:[5,0,7,6,8],statu:1,kei:[3,4,1,5],endblocktran:8,databas:[0,1,4],someth:[5,4,6,8],unregistr:5,label:3,figur:8,add_templ:5,progress:0,thumbnail:8,modeladmin:[3,5,6],attribut:[5,0,1,6],altern:0,step:8,extend:[5,6,7],generic_form_exampl:5,javascript:[0,1,5,6,7,8],source_url:1,extens:[3,8],job:1,mygenericchannel:3,complementari:[5,1],csvchannelbas:3,relatedobjectsdescriptor:3,somechannel:5,"__unicode__":3,addit:4,generic_m2m_field:3,both:[5,1],last:[4,8],get_source_url_data:1,plugin:5,admin:[0,3,4,5,6,7],howev:[5,8,2],test_api_project:[4,1],foreign:[3,4],len:8,etc:4,instanc:[3,5,7,1,6],context:[5,8,1],logic:[3,0,6,5],fk_field:3,countri:[5,4,7,1,6],login:4,com:[5,0,6,8,4],autocomplete_light_stat:5,comment:[5,6,7],widget_inst:5,debugg:0,iterablesselector:8,inspir:8,wrap:[3,5],header:8,countryc:[5,6,7],exclud:3,guid:8,assum:[6,4],haystack_search:8,backend:3,reciev:5,coupl:[3,5],get_remote_result:1,window:8,empti:[5,6],json:[5,6,1],treat:3,basic:[5,0,6,4],hesit:0,unregist:5,optionn:1,pushov:0,fire:8,imag:8,suscept:1,convert:3,autocomplete_light_vers:4,mail:0,i18n:[5,6,7,8],autocomplete_light_widget:[5,1],present:8,gracious:0,"case":[3,5,6],taggeditem:3,look:[5,8],selectmultipl:[5,6],remotecountrychannel:1,align:8,autocomplete_light:[0,1,2,3,4,5,6,7,8],aim:1,defin:[8,2],selectopt:8,fun:[0,1],endblock:[5,6,7],firebug:0,spawn:5,finnali:5,would:[3,5,1,8,6],helper:[5,0],readi:[8,1],demo:[0,4],cities_light_vers:4,non:8,worri:[5,6],kwarg:[3,5,1,6],dual:4,gfk:3,crash:8,autocomplete_light_registri:[5,4,6],"__init__":5,around:[3,5],decor:[5,6],develop:[6,0,8,2,4],welcom:0,author:[5,6,2],perform:0,suggest:[3,4,1,5],make:[0,1,3,4,5,8],same:[5,0,4],content_object:3,html:[0,1,5,6,7,8],result_as_html:5,hahah:8,order_bi:3,document:[0,1,2,3,5,6,8],conflict:5,complet:1,exhaust:2,finish:6,http:[0,1,4,5,6,8],genericmodelform:3,effect:0,alert:8,max_item:[3,5,6],user:[0,1,8,4],mani:[3,5],extern:3,wherev:0,save_m2m:3,chang:8,kudo:3,appropri:5,thu:[5,4],genericforeignkei:[3,0],well:[5,6,8],without:[3,5],pep8:0,exampl:[0,1,3,5,6,8],endfor:[5,8],endif:[5,8],undefin:8,everyth:5,rout:5,propos:[0,1],last_name__icontain:8,load:[5,0,7,6,8],just:[3,0,1,8,5],less:0,instanci:[5,1],rest:1,belgium:4,human:8,simpli:8,yet:0,result_as_dict:1,web:8,password:4,easi:0,mix:8,ipdb:0,point:6,modelchoicefield:[5,0,6],add:[1,3,4,5,6,8],limit_result:[3,5,1],els:[5,8],haystack:8,save:[3,1],app:[0,2,3,5,6,7,8],smart:0,bin:4,applic:5,render_autocomplet:5,which:[3,4,1,5],format:1,handl:[3,5],jpic:4,folk:8,know:[5,0,4],insert:5,field_nam:5,world:[4,1],value_from_datadict:5,httprespons:5,recurs:1,like:[0,1,3,4,5,6,8],textstatu:1,search_form:8,to_python:3,success:1,authorform:2,should:[0,1,2,3,4,5,6,7,8],signal:3,staticfil:[6,0],noth:8,collect:5,href:[5,8],necessari:[3,5,1],"_deck":5,fill:[5,0],async:1,manag:[6,4],right:3,ct_field:3,some:[5,8,1],"export":[5,6],cityautocompletewidget:5,syncdb:4,bore:3,server:[6,0,4],registri:[5,0,6],virtualenv:4,txt:4,remotegetvalu:1,countrychannel:5,avoid:3,modelform_factori:[5,0,6,2],definit:[5,0],subclass:[3,5],"16x16":8,unit:4,autocompletewidget:[3,5,7,6],three:5,localhost:[4,1],either:[5,4,1],run:[6,4],full_nam:6,someel:5,jqxhr:1,inspect:5,usag:[0,1,3,5,6,8],host:0,project_specific_autocomplet:8,repositori:4,offset:5,post:[5,1],yourlabs_autocomplet:[5,8],"super":[5,6,7],order_result:[3,5],src:[5,4,7,6,8],about:[5,6,1],actual:[5,8,1],blocktran:8,modelgroupform:3,endcom:[5,6,7],side:0,constructor:[5,6],ajax:[5,0,1,8,6],commit:3,book:6,block:[5,6,7,1],own:[3,0,7,6,5],additionn:[5,6,7],profession:0,easy_instal:4,automat:[5,6],two:[5,4,8],been:1,contrib:[3,0,1,6,5],reli:[3,2],your:[0,1,2,3,4,5,6,7,8],fast:6,span:5,heheh:4,val:8,yourinit:5,support:[3,0,2],question:0,stylesheet:5,"long":8,custom:6,avail:[5,1],start:[5,0,6],compliant:0,includ:[5,4,7,1,6],suit:[5,6],"var":[8,1],music:1,"function":[5,8,1],form:[0,2,3,5,6,8],forc:3,subscrib:0,continu:0,bodi:[0,1],genericforeignkeyfield:[3,0],first_imag:8,modelgroup:3,"_source_url":1,inlin:[0,4],"true":[3,5,8],bug:0,pull:0,made:3,input:[5,0,1,8,6],consist:3,personnali:8,"default":[3,5,1,6],maximum:3,until:3,jqueryui:8,foreignkei:[5,6],autocomplet:[0,1,2,3,4,5,6,7,8],otherwis:1,inform:0,connect:8,trim:8,model:[1,2,3,5,6,8],featur:[0,4],creat:[0,1,5,6,7,8],request:[3,0,1,8,5],dure:8,doesn:[3,8],repres:1,genericm2m:3,shortcut:[5,8],file:[3,5,6],pip:[6,0,4],ship:5,doe:[3,5,1,2],check:[5,1],probabl:[3,5,6],again:[3,4,5],googl:0,want:[0,3,4,5,6,8],titl:7,channelregistri:5,when:[0,2,3,4,5,6,8],detail:5,virtual:3,zindex:8,field:[3,5,6],valid:[3,5,8],futur:8,test:[4,1,8],addressform:5,you:[0,1,2,3,4,5,6,7,8],unlimit:0,nice:8,get_queryset:[3,5],clean:0,fulli:0,why:4,slice:5,queri:[8,1],autocomplete_templ:[3,5,1],consid:[5,8,1],itself:3,ignor:5,time:[3,6],newli:1},objtypes:{"0":"py:module","1":"py:class","2":"py:method","3":"py:function"},titles:["Welcome to django-autocomplete-light’s documentation!","Proposing results from a remote API","Django 1.3 support workarounds","GenericForeignKey support","django-autocomplete-light demo","Integration with forms","Quick start","<no title>","Making a global navigation autocomplete"],objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"],"3":["py","function","Python function"]},filenames:["index","remote","django13","generic","demo","forms","quick","_admin_template","navigation"]})PK6@o}[ YY-django-autocomplete-light-0.8/navigation.html Making a global navigation autocomplete — django-autocomplete-light 0.7 documentation

Making a global navigation autocomplete

This guide demonstrates how to make a global navigation autocomplete like on http://betspire.com.

Create the view

The global navigation autocomplete is generated by a normal view, with a normal template.

Then, you can just test it by openning /your/autocomplete/url/?q=someString

Only two things matter:

  • you should be able to define a selector for your options. For example, your autocomplete template could contain a list of divs with class “option”, and your selector would be ‘.option’.
  • each option should contain an url of course, to redirect the user when he selects a option

Actually, it’s not totally true, you could do however you want, but that’s a simple way i’ve found.

Once this works, you can follow to the next step. For your inspiration, you may also read the following example.

Example

Personnaly, I like to have an app called ‘project_specific’ where I can put my project-specific, non-reusable, code. So in project_specific/autocomplete.py of a project I have this:

from django import shortcuts
from django.db.models import Q

from art.models import Artist, Artwork

def autocomplete(request,
    template_name='project_specific/autocomplete.html', extra_context=None):
    q = request.GET['q'] # crash if q is not in the url
    context = {
        'q': q,
    }

    queries = {}
    queries['artworks'] = Artwork.objects.filter(
        name__icontains=q).distinct()[:3]
    queries['artists'] = Artist.objects.filter(
        Q(first_name__icontains=q)|Q(last_name__icontains=q)|Q(name__icontains=q)
        ).distinct()[:3]
    # more ...

    # install queries into the context
    context.update(queries)

    # mix options
    options = 0
    for query in queries.values():
        options += len(query)
    context['options'] = options

    return shortcuts.render(request, template_name, context)

And in project_specific/autocomplete.html:

{% load i18n %}
{% load thumbnail %}
{% load url from future %}
{% load humanize %}

<ul>
{% if artworks %}
    <li><em>{% trans 'Artworks' %}</em></li>
    {% for artwork in artworks %}
        <li class="artwork">
            <a href="{{ artwork.get_absolute_url }}">
                {% if artwork.first_image %}
                    <img src="{% thumbnail artwork.first_image 16x16 %}" style="vertical-align: middle" />
                {% endif %}
                {{ artwork }}
            </a>
        </li>
    {% endfor %}
{% endif %}
{% if artists %}
    <li><em>{% trans 'Artists' %}</em></li>
    {% for artist in artists %}
        <li class="artist">
            <a href="{{ artist.get_absolute_url }}">
                {% if artist.image %}
                    <img src="{% thumbnail artist.image 16x16 %}" style="vertical-align: middle" />
                {% endif %}

                {{ artist }}
            </a>
        </li>
    {% endfor %}
{% endif %}
{# more ...}

{% if not options %}
    <li><em>{% trans 'No options' %}</em></li>
    <li><a href="{% url 'haystack_search' %}?q={{ q|urlencode }}">{% blocktrans %}Search for {{ q }}{% endblocktrans %}</a></li>
{% endif %}

</ul>

In this template, my option selector is simply ‘li:has(a)’. So every <a> tag that is in an li with an a tag will be considered as a valid option by the autocomplete.

As for the url, it looks like this:

url(
    r'^autocomplete/$',
    views.autocomplete,
    name='project_specific_autocomplete',
),

So, nothing really special here ... and that’s what I like with this autocomplete. You can use the presentation you want as long as you have a selector for your options.

Create the input

Nothing magical here, just add an HTML input to your base template, for example:

<input type="text" name="q" id="main_autocomplete" />

Of course, if you have haystack or any kind of search, you could use it as well, it doesn’t matter:

<form action="{% url haystack_search %}" method="get">
    {{ search_form.q }}
</form>

Loading the script

If you haven’t done it already, load jQuery and the yourlabs_autocomplete extension, for example:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script src="{{ STATIC_URL }}autocomplete_light/autocomplete.js" type="text/javascript"></script>

Script usage

The last thing we need to do is to connect the autocomplete script with the input and the autocomplete view. Something like this would work:

<script type="text/javascript">
$(document).ready(function() {
    $('input#main_autocomplete').yourlabs_autocomplete({
        url: '{% url project_specific_autocomplete %}',
        zindex: 99999,
        id: 'main_autocomplete',
        iterablesSelector: 'li:has(a)',
        defaultValue: "{% trans 'Search : an artwork, an artist, a user, a contact...' %}",
    });
});
</script>

There are other options. If these don’t work very well for you, you should read autocomplete.js. It’s not a fat bloated script like jQueryUi autocomplete with tons of dependencies, so it shouldn’t be that hard to figure it out.

The other thing you want to do, is bind an event to the event yourlabs_autocomplete.selectOption, that is fired when the user selects an option by clicking on it for example:

<script type="text/javascript">
$(document).ready(function() {
    $('#search_bloc input[name=q]').bind('yourlabs_autocomplete.selectOption', function(e, option) {
        var autocomplete = $(this).yourlabs_autocomplete();

        // hide the autocomplete
        autocomplete.hide();

        // change the input's value to 'loading page: some page'
        autocomplete.el.val('{% trans 'loading page' %}: ' + $.trim(option.text()));

        // find the url of the option
        link = $(option).find('a:first');

        // if the link looks good
        if (link.length && link.attr('href') != undefined) {
            // open the link
            window.location.href = link.attr('href');
            return false;
        } else {
            // that should only happen during development !!
            alert('sorry, i dunno what to do with your selection!!');
        }
    });
});
</script>

That’s all folks ! Enjoy your fine global navigation autocomplete. Personnaly I think there should be one in the header of every project, it is just so convenient for the user. And if nicely designed, it is very ‘web 2.0’ whatever it means hahah.

Project Versions

Table Of Contents

Previous topic

Quick start

Next topic

Integration with forms

This Page

PK6@=]>>'django-autocomplete-light-0.8/demo.html django-autocomplete-light demo — django-autocomplete-light 0.7 documentation

django-autocomplete-light demo

The test_project lives in the test_project subdirectory of django-autocomplete-light’s repository.

Install

We’re going to use virtualenv, so that we don’t pollute your system when installing dependencies. If you don’t already have virtualenv, you can install it either via your package manager, either via python’s package manager with something like:

sudo easy_install virtualenv

Install last release:

rm -rf django-autocomplete-light autocomplete_light_env/

virtualenv autocomplete_light_env
source autocomplete_light_env/bin/activate
git clone https://jpic@github.com/yourlabs/django-autocomplete-light.git
cd django-autocomplete-light/test_project
pip install -r requirements.txt
./manage.py runserver

Install development versions, if you want to contribute hehehe:

AUTOCOMPLETE_LIGHT_VERSION="master"
CITIES_LIGHT_VERSION="master"

rm -rf autocomplete_light_env/

virtualenv autocomplete_light_env
source autocomplete_light_env/bin/activate
pip install -e git+git://github.com/yourlabs/django-cities-light.git@$CITIES_LIGHT_VERSION#egg=cities_light
pip install -e git+git://github.com/yourlabs/django-autocomplete-light.git@$AUTOCOMPLETE_LIGHT_VERSION#egg=autocomplete_light
cd autocomplete_light_env/src/autocomplete-light/test_project
pip install -r requirements.txt
./manage.py runserver

Login with user “test” and password “test”.

If you want to redo the database, but make sure you read README first:

rm db.sqlite
./manage.py syncdb
./manage.py cities_light

Try basic features

Once you have the test_project server running (see INSTALL if you don’t), open the first contact.

You will see two addresses:

  • one at Paris, France
  • one at Paris, United States

The reason for that is that there are several cities in the world with the name “Paris”. This is the reason why the double autocomplete widget is interresting: it filters the cities based on the selected country.

Note that only cities from France, USA and Belgium are in the demo database.

Note that you can test autocompletes for generic foreign keys in this project too.

Try advanced features

Assuming you installed the test_project, all you need in addition is to install requirements for this project:

cd autocomplete_light_env/src/autocomplete-light/test_api_project
pip install -r requirements.txt

Then, refer to README.rst in this folder.

This project demonstrates how the autocomplete can suggest results from a remote API - and thus which don’t have a pk in the local database.

In one console:

cd test_project
./manage.py runserver

In another:

cd test_api_project
./manage.py runserver 127.0.0.1:8001

In http://localhost:8001/admin, you should be able to test:

  • compatibility with django-admintools-bootstrap
  • generic fk autocomplete
  • generic m2m autocomplete
  • remote api autocomplete (cities/countries are suggested and imported from test_project)
  • autocompletes in inlines, dual widget, etc, etc ...

If you’re not going to use localhost:8000 for test_project, then you should update source urls in test_api_project/test_api_project/autocomplete_light_registry.py.

Now, note that there are no or few countries in test_api_project database.

Again, test_project’s database only includes countries France, Belgium and America so there’s no need to try the other one unless you know what you’re doing.

Also note that, city and country autocomplete work the same. The reason for that is that test_api_project uses City and Country remote channel to add results to the autocomplete that are not in the local database.

Project Versions

Table Of Contents

Previous topic

Welcome to django-autocomplete-light’s documentation!

Next topic

Quick start

This Page

PK6@--+django-autocomplete-light-0.8/django13.html Django 1.3 support workarounds — django-autocomplete-light 0.7 documentation

Django 1.3 support workarounds

The app is was developed for Django 1.4. However, there are workarounds to get it to work with Django 1.3 too. This document attemps to provide an exhaustive list of notes that should be taken in account when using the app with django-autocomplete-light.

modelform_factory

The provided autocomplete_light.modelform_factory relies on Django 1.4’s modelform_factory that accepts a ‘widgets’ dict.

Django 1.3 does not allow such an argument. You may however define your form as such:

class AuthorForm(forms.ModelForm):
    class Meta:
        model = Author
        widgets = autocomplete_light.get_widgets_dict(Author)

Project Versions

Table Of Contents

Previous topic

Proposing results from a remote API

This Page

PK6@b<==*django-autocomplete-light-0.8/generic.html GenericForeignKey support — django-autocomplete-light 0.7 documentation

GenericForeignKey support

Generic foreign keys are supported since 0.4.

GenericChannelBase

Example

import autocomplete_light

from models import Contact, Address

class MyGenericChannel(autocomplete_light.GenericChannelBase):
    def get_querysets(self):
        return {
            Contact: Contact.objects.all(),
            Address: Address.objects.all(),
        }

    def order_results(self, results):
        if results.model == Address:
            return results.order_by('street')
        elif results.model == Contact:
            return results.order_by('name')

    def query_filter(self, results):
        q = self.request.GET.get('q', None)

        if q:
            if results.model == Address:
                results = results.filter(street__icontains=q)
            elif results.model == Contact:
                results = results.filter(name__icontains=q)

        return results

autocomplete_light.register(MyGenericChannel)

API

class autocomplete_light.channel.generic.GenericChannelBase[source]

Wraps around multiple querysets, from multiple model classes, rather than just one.

This is also interresting as it overrides all the default model logic from ChannelBase. Hell, you could even copy it and make your CSVChannelBase, a channel that uses a CSV file as backend. But only if you’re really bored or for a milion dollars.

Set result_template and autocomplete_template if necessary.

are_valid(values)[source]

Return True if it can find all the models refered by values.

get_results(values=None)[source]

Return results for each queryset returned by get_querysets().

Note that it limits each queryset’s to self.limit_result. If you want a maximum of 12 suggestions and have a total of 4 querysets, then self.limit_results should be set to 3.

order_results(results)[source]

Return results, without doing any ordering.

In most cases, you would not have to override this method as querysets should be ordered by default, based on model.Meta.ordering.

result_as_value(result)[source]

Rely on GenericForeignKeyField to return a string containing the content type id and object id of the result.

Because this channel is made for that field, and to avoid code duplication.

values_filter(results, values)[source]

Filter out any result from results that is not refered to by values.

GenericForeignKeyField

Example

import autocomplete_light

from models import TaggedItem


class TaggedItemForm(autocomplete_light.GenericModelForm):
    content_object = autocomplete_light.GenericForeignKeyField(
        widget=autocomplete_light.AutocompleteWidget(
            'MyGenericChannel', max_items=1))

    class Meta:
        model = TaggedItem
        widgets = autocomplete_light.get_widgets_dict(TaggedItem)
        exclude = (
            'content_type',
            'object_id',
        )

API

class autocomplete_light.generic.GenericModelForm(*args, **kwargs)[source]

This simple subclass of ModelForm fixes a couple of issues with django’s ModelForm.

  • treat virtual fields like GenericForeignKey as normal fields, Django should already do that but it doesn’t,
  • when setting a GenericForeignKey value, also set the object id and content type id fields, again Django could probably afford to do that.

What ModelForm does, but also add virtual field values to self.initial.

save(commit=True)[source]

What ModelForm does, but also set GFK.ct_field and GFK.fk_field if such a virtual field has a value.

This should probably be done in the GFK field itself, but it’s here for convenience until Django fixes that.

class autocomplete_light.generic.GenericForeignKeyField(required=True, widget=None, label=None, initial=None, help_text=None, error_messages=None, show_hidden_initial=False, validators=[], localize=False)[source]

Simple form field that converts strings to models.

prepare_value(value)[source]

Given a model instance as value, with content type id of 3 and pk of 5, return such a string ‘3-5’.

to_python(value)[source]

Given a string like ‘3-5’, return the model of content type id 3 and pk 5.

GenericManyToMany

Example

Example model with related:

from django.db import models
from django.db.models import signals
from django.contrib.contenttypes import generic

from genericm2m.models import RelatedObjectsDescriptor

class ModelGroup(models.Model):
    name = models.CharField(max_length=100)

    related = RelatedObjectsDescriptor()

    def __unicode__(self):
        return self.name

Example generic_m2m.GenericModelForm usage:

import autocomplete_light
from autocomplete_light.contrib.generic_m2m import GenericModelForm, \
    GenericManyToMany

from models import ModelGroup


class ModelGroupForm(GenericModelForm):
    related = GenericManyToMany(
        widget=autocomplete_light.AutocompleteWidget('MyGenericChannel'))

    class Meta:
        model = ModelGroup

Example ModelAdmin:

from django.contrib import admin

from models import ModelGroup
from forms import ModelGroupForm


class ModelGroupAdmin(admin.ModelAdmin):
    form = ModelGroupForm
admin.site.register(ModelGroup, ModelGroupAdmin)

API

autocomplete_light.contrib.generic_m2m couples django-autocomplete-light with django-generic-m2m.

Generic many to many are supported since 0.5. It depends on django-generic-m2m external apps. Follow django-generic-m2m installation documentation, but at the time of writing it barely consists of adding the genericm2m to INSTALLED_APPS, and adding a field to models that should have a generic m2m relation. So, kudos to the maintainers of django-generic-m2m, fantastic app, use it for generic many to many relations.

See examples in test_project/generic_m2m_example.

class autocomplete_light.contrib.generic_m2m.GenericManyToMany(required=True, widget=None, label=None, initial=None, help_text=None, error_messages=None, show_hidden_initial=False, validators=[], localize=False)[source]

Simple form field that converts strings to models.

class autocomplete_light.contrib.generic_m2m.GenericModelForm(*args, **kwargs)[source]

Extension of autocomplete_light.GenericModelForm, that handles genericm2m’s RelatedObjectsDescriptor.

Add related objects to initial for each generic m2m field.

generic_m2m_fields()[source]

Yield name, field for each RelatedObjectsDescriptor of the model of this ModelForm.

save(commit=True)[source]

Sorry guys, but we have to force commit=True and call save_m2m() right after.

The reason for that is that Django 1.4 kind of left over cases where we wanted to override save_m2m: it enforces its own, which does not care of generic_m2m of course.

save_m2m()[source]

Save selected generic m2m relations.

Project Versions

Table Of Contents

Previous topic

Integration with forms

Next topic

Proposing results from a remote API

This Page

PK6@xlKK)django-autocomplete-light-0.8/objects.inv# Sphinx inventory version 2 # Project: django-autocomplete-light # Version: 0.7 # The remainder of this file is compressed using zlib. xڵXIo0+,5WPcniTi)Mhy{bIf 2C.Y// Sq^3$Uv] (T\AUU };R"MЬgȹdKPH(gsMӧd=\l??RQN1(=+aLɨevgu EH}{ZR@$RC, ,ѡ%L-D"i*؈O3zA4Ο{Ђ}-2l J] sŒU% ;5A\֥(Bđ(M] r:qѕVˑEpVDV<V%.C;\WF첇Gp$}lҕ ˼(r)yHøP0 P[.Ә{YZm]k~rIK"%TlJ'㱓VNF@'E Eb\P[-2j*2BwckJakEӱ  ݡ5*h=/e Fs AyR'(숀T-)A&Uh]Fe6~mɰv};v s U0& h0yhG~49Zb5'c[Is>4Ԩ ?>&[:ĒV7q.3oAw#\]*hH^jUj[V)H?V˚VZێΚA coO6 Έ"X65V[jWa_$`i],W;rMp^jl%>KHw5[5]7m[i[zvx$0t<:b$dRFU _u>-k&2hp] 2TC73Ja='zu|P+Ѝ^PK6@q?**2django-autocomplete-light-0.8/_admin_template.html <no title> — django-autocomplete-light 0.7 documentation

For AutocompleteWidget to be enabled in the admin, you should create your own admin/base_site.html template as demonstrated in test_project/templates/admin/base_site.html:

{% extends "admin/base.html" %}
{% load i18n %}

{% block footer %}
    {{ block.super }}

    <script src="{{ STATIC_URL }}jquery.js" type="text/javascript"></script>
    {% include 'autocomplete_light/static.html' %}
    {% comment %}
    Load additionnal script or style dependencies here. For instance, the
    double country/city autocomplete widget requires the countrycity deck
    bootstrap so we'll load it. But you don't need this one if you don't use
    the countrycity widget of the cities_light app.
    {% endcomment %}
    <script src="{{ STATIC_URL }}cities_light/autocomplete_light.js" type="text/javascript"></script>
{% endblock %}

Project Versions

This Page

PK6@;m%%)django-autocomplete-light-0.8/search.html Search — django-autocomplete-light 0.7 documentation

Search

Please activate JavaScript to enable the search functionality.

From here you can search these documents. Enter your search words into the box below and click "search". Note that the search function will automatically search for all of the words. Pages containing fewer words won't appear in the result list.

Project Versions

PK6@E3>[>[+django-autocomplete-light-0.8/genindex.html Index — django-autocomplete-light 0.7 documentation

Index

A | C | F | G | I | M | O | P | Q | R | S | T | U | V

A

are_valid() (autocomplete_light.channel.base.ChannelBase method)
(autocomplete_light.channel.generic.GenericChannelBase method)
as_dict() (autocomplete_light.channel.base.ChannelBase method)
autocomplete_light.channel.base (module)
autocomplete_light.channel.generic (module)
autocomplete_light.channel.remote (module)
autocomplete_light.contrib.generic_m2m (module)
autocomplete_light.forms (module)
autocomplete_light.generic (module)
autocomplete_light.registry (module)
autocomplete_light.widgets (module)
AutocompleteWidget (class in autocomplete_light.widgets)
autodiscover() (in module autocomplete_light.registry)

C

channel_for_model() (autocomplete_light.registry.ChannelRegistry method)
ChannelBase (class in autocomplete_light.channel.base)
ChannelRegistry (class in autocomplete_light.registry)
ChannelView (class in autocomplete_light.views)

F

fetch() (autocomplete_light.channel.remote.RemoteChannelBase method)
fetch_result() (autocomplete_light.channel.remote.RemoteChannelBase method)

G

generic_m2m_fields() (autocomplete_light.contrib.generic_m2m.GenericModelForm method)
GenericChannelBase (class in autocomplete_light.channel.generic)
GenericForeignKeyField (class in autocomplete_light.generic)
GenericManyToMany (class in autocomplete_light.contrib.generic_m2m)
GenericModelForm (class in autocomplete_light.contrib.generic_m2m)
(class in autocomplete_light.generic)
get() (autocomplete_light.views.ChannelView method)
get_absolute_url() (autocomplete_light.channel.base.ChannelBase method)
get_queryset() (autocomplete_light.channel.base.ChannelBase method)
get_remote_results() (autocomplete_light.channel.remote.RemoteChannelBase method)
get_results() (autocomplete_light.channel.base.ChannelBase method)
(autocomplete_light.channel.generic.GenericChannelBase method)
(autocomplete_light.channel.remote.RemoteChannelBase method)
get_source_url() (autocomplete_light.channel.remote.RemoteChannelBase method)
get_source_url_data() (autocomplete_light.channel.remote.RemoteChannelBase method)
get_widgets_dict() (in module autocomplete_light.forms)

I

init_for_request() (autocomplete_light.channel.base.ChannelBase method)

M

model_for_source_url() (autocomplete_light.channel.remote.RemoteChannelBase method)
modelform_factory() (in module autocomplete_light.forms)

O

order_results() (autocomplete_light.channel.base.ChannelBase method)
(autocomplete_light.channel.generic.GenericChannelBase method)

P

post() (autocomplete_light.channel.remote.RemoteChannelBase method)
(autocomplete_light.views.ChannelView method)
prepare_value() (autocomplete_light.generic.GenericForeignKeyField method)

Q

query_filter() (autocomplete_light.channel.base.ChannelBase method)

R

register() (autocomplete_light.registry.ChannelRegistry method)
(in module autocomplete_light.registry)
register_channel() (autocomplete_light.registry.ChannelRegistry method)
register_model_channel() (autocomplete_light.registry.ChannelRegistry method)
RemoteChannelBase (class in autocomplete_light.channel.remote)
render() (autocomplete_light.widgets.AutocompleteWidget method)
render_autocomplete() (autocomplete_light.channel.base.ChannelBase method)
result_as_dict() (autocomplete_light.channel.remote.RemoteChannelBase method)
result_as_html() (autocomplete_light.channel.base.ChannelBase method)
result_as_value() (autocomplete_light.channel.base.ChannelBase method)
(autocomplete_light.channel.generic.GenericChannelBase method)
(autocomplete_light.channel.remote.RemoteChannelBase method)

S

save() (autocomplete_light.contrib.generic_m2m.GenericModelForm method)
(autocomplete_light.generic.GenericModelForm method)
save_m2m() (autocomplete_light.contrib.generic_m2m.GenericModelForm method)

T

to_python() (autocomplete_light.generic.GenericForeignKeyField method)

U

unregister() (autocomplete_light.registry.ChannelRegistry method)

V

value_from_datadict() (autocomplete_light.widgets.AutocompleteWidget method)
values_filter() (autocomplete_light.channel.base.ChannelBase method)
(autocomplete_light.channel.generic.GenericChannelBase method)

Project Versions

PK6@ڌӽ(django-autocomplete-light-0.8/.buildinfo# Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. config: 2751658c68913eb08460853a5ccaa48e tags: fbb0d17656682115ca4d033fb2f83ba1 PK6@OF+mm)django-autocomplete-light-0.8/remote.html Proposing results from a remote API — django-autocomplete-light 0.7 documentation

Proposing results from a remote API

This documentation is optionnal, but it is complementary with all other documentation. It aims advanced users.

Consider a social network about music. In order to propose all songs in the world in its autocomplete, it should either:

  • have a database with all songs of the world,
  • use a simple REST API to query a database with all songs world

The purpose of this documentation is to describe every elements involved. Note that a living demonstration is available in test_api_project, where one project serves a full database of cities via an API to another.

Example

In test_api_project, of course you should not hardcode urls like that in actual projects:

import autocomplete_light

from cities_light.contrib.autocomplete_light_restframework import RemoteCountryChannel, RemoteCityChannel
from cities_light.models import City, Country

autocomplete_light.register(Country, RemoteCountryChannel,
    source_url = 'http://localhost:8000/cities_light/country/')
autocomplete_light.register(City, RemoteCityChannel,
    source_url = 'http://localhost:8000/cities_light/city/')

Check out the documentation of RemoteCountryChannel and RemoteCityChannel for more.

API

class autocomplete_light.channel.remote.RemoteChannelBase[source]

Uses an API to propose suggestions from an HTTP API, tested with djangorestframework.

model_for_source_url
A very important function to override! take an API URL and return the corresponding model class. This is API specific, there is a complete example in cities_light.contrib.
source_url
The full URL to the list API. For example, to a djangorestframework list view.

An example implementation usage is demonstrated in the django-cities-light contrib folder.

Autocomplete box display chronology:

  • autocomplete.js requests autocomplete box to display for an input,
  • get_results() fetches some extra results via get_remote_results(),
  • get_remote_results() calls source_url and returns a list of models,
  • the remote results are rendered after the local results in widget.html. It includes some JSON in a hidden textarea, like the API’s url for each result.

Remote result selection chronology:

  • deck.js calls remoteGetValue() instead of the default getValue(),
  • remoteGetValue() posts the json from the result to ChannelView,
  • ChannelView.post() does its job of proxying RemoteChannelBase.post(),
  • RemoteChannelBase.post() returns an http response which body is just the pk of the result in the local database, using self.fetch_result(),
  • self.fetch_result() passes the API url of the result and recursively saves the remote models into the local database, returning the id of the newly created object.

Set result_template and autocomplete_template if necessary.

fetch(url)[source]

Given an url to a remote object, return the corresponding model from the local database.

The default implementation expects url to respond with a JSON dict of the attributes of an object.

For relation attributes, it expect the value to be another url that will respond with a JSON dict of the attributes of the related object.

It calls model_for_source_url() to find which model class corresponds to which url. This allows fetch() to be recursive.

fetch_result(result)[source]

Take a result’s dict representation, return it’s local pk which might have been just created.

If your channel works with 0 to 1 API call, consider overriding this method. If your channel is susceptible of using several different API calls, consider overriding fetch().

get_remote_results(max)[source]

Parses JSON from the API, return model instances.

The JSON should contain a list of dicts. Each dict should contain the attributes of an object. Relation attributes should be represented by their url in the API, which is set to model._source_url.

get_results(values=None)[source]

Returns a list of results from both the local database and the API if in the context of a request.

Using self.limit_results and the number of local results, adds results from get_remote_results().

get_source_url(limit)[source]

Return an API url for the current autocomplete request.

By default, return self.source_url with the data dict returned by get_source_url_data().

get_source_url_data(limit)[source]

Given a limit of items, return a dict of data to send to the API.

By default, it passes current request GET arguments, along with format: ‘json’ and the limit.

model_for_source_url(url)[source]

Take an URL from the API this remote channel is supposed to work with, return the model class to use for that url.

It is only needed for the default implementation of fetch(), because it has to follow relations recursively.

post(request, *args, **kwargs)[source]

Take POST variable ‘result’, install it in the local database, return the newly created id.

The HTTP response has status code 201 Created.

result_as_dict(result)[source]

Return the result pk or _source_url.

result_as_value(result)[source]

Return the result pk or source url.

Javascript fun

Channels with bootstrap=’remote’ get a deck using RemoteChannelDeck’s getValue() rather than the default getValue() function.

var RemoteChannelDeck = {
    // The default deck getValue() implementation just returns the PK from the
    // result HTML. RemoteChannelDeck's implementation checks for a textarea
    // that would contain a JSON dict in the result's HTML. If the dict has a
    // 'value' key, then return this value. Otherwise, make a blocking ajax
    // request: POST the json dict to the channel url. It expects that the
    // response will contain the value.
    getValue: function(result) {
        data = $.parseJSON(result.find('textarea').html());

        if (data.value) return data.value;

        var value = false;
        $.ajax(this.payload.channel.url, {
            async: false,
            type: 'post',
            data: {
                'result': result.find('textarea').html(),
            },
            success: function(text, jqXHR, textStatus) {
                value = text;
            }
        });

        return value;
    }
}

$(document).ready(function() {
    // Instanciate decks with RemoteChannelDeck as override for all widgets with
    // channel 'remote'.
    $('.autocomplete_light_widget[data-bootstrap=remote]').each(function() {
        $(this).yourlabs_deck(RemoteChannelDeck);
    });
});

Project Versions

Table Of Contents

Previous topic

GenericForeignKey support

Next topic

Django 1.3 support workarounds

This Page

PK6@:>>>4django-autocomplete-light-0.8/_static/searchtools.js/* * searchtools.js_t * ~~~~~~~~~~~~~~~~ * * Sphinx JavaScript utilties for the full-text search. * * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. * :license: BSD, see LICENSE for details. * */ /** * helper function to return a node containing the * search summary for a given text. keywords is a list * of stemmed words, hlwords is the list of normal, unstemmed * words. the first one is used to find the occurance, the * latter for highlighting it. */ jQuery.makeSearchSummary = function(text, keywords, hlwords) { var textLower = text.toLowerCase(); var start = 0; $.each(keywords, function() { var i = textLower.indexOf(this.toLowerCase()); if (i > -1) start = i; }); start = Math.max(start - 120, 0); var excerpt = ((start > 0) ? '...' : '') + $.trim(text.substr(start, 240)) + ((start + 240 - text.length) ? '...' : ''); var rv = $('
').text(excerpt); $.each(hlwords, function() { rv = rv.highlightText(this, 'highlighted'); }); return rv; } /** * Porter Stemmer */ var Stemmer = function() { var step2list = { ational: 'ate', tional: 'tion', enci: 'ence', anci: 'ance', izer: 'ize', bli: 'ble', alli: 'al', entli: 'ent', eli: 'e', ousli: 'ous', ization: 'ize', ation: 'ate', ator: 'ate', alism: 'al', iveness: 'ive', fulness: 'ful', ousness: 'ous', aliti: 'al', iviti: 'ive', biliti: 'ble', logi: 'log' }; var step3list = { icate: 'ic', ative: '', alize: 'al', iciti: 'ic', ical: 'ic', ful: '', ness: '' }; var c = "[^aeiou]"; // consonant var v = "[aeiouy]"; // vowel var C = c + "[^aeiouy]*"; // consonant sequence var V = v + "[aeiou]*"; // vowel sequence var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0 var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1 var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1 var s_v = "^(" + C + ")?" + v; // vowel in stem this.stemWord = function (w) { var stem; var suffix; var firstch; var origword = w; if (w.length < 3) return w; var re; var re2; var re3; var re4; firstch = w.substr(0,1); if (firstch == "y") w = firstch.toUpperCase() + w.substr(1); // Step 1a re = /^(.+?)(ss|i)es$/; re2 = /^(.+?)([^s])s$/; if (re.test(w)) w = w.replace(re,"$1$2"); else if (re2.test(w)) w = w.replace(re2,"$1$2"); // Step 1b re = /^(.+?)eed$/; re2 = /^(.+?)(ed|ing)$/; if (re.test(w)) { var fp = re.exec(w); re = new RegExp(mgr0); if (re.test(fp[1])) { re = /.$/; w = w.replace(re,""); } } else if (re2.test(w)) { var fp = re2.exec(w); stem = fp[1]; re2 = new RegExp(s_v); if (re2.test(stem)) { w = stem; re2 = /(at|bl|iz)$/; re3 = new RegExp("([^aeiouylsz])\\1$"); re4 = new RegExp("^" + C + v + "[^aeiouwxy]$"); if (re2.test(w)) w = w + "e"; else if (re3.test(w)) { re = /.$/; w = w.replace(re,""); } else if (re4.test(w)) w = w + "e"; } } // Step 1c re = /^(.+?)y$/; if (re.test(w)) { var fp = re.exec(w); stem = fp[1]; re = new RegExp(s_v); if (re.test(stem)) w = stem + "i"; } // Step 2 re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; if (re.test(w)) { var fp = re.exec(w); stem = fp[1]; suffix = fp[2]; re = new RegExp(mgr0); if (re.test(stem)) w = stem + step2list[suffix]; } // Step 3 re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; if (re.test(w)) { var fp = re.exec(w); stem = fp[1]; suffix = fp[2]; re = new RegExp(mgr0); if (re.test(stem)) w = stem + step3list[suffix]; } // Step 4 re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; re2 = /^(.+?)(s|t)(ion)$/; if (re.test(w)) { var fp = re.exec(w); stem = fp[1]; re = new RegExp(mgr1); if (re.test(stem)) w = stem; } else if (re2.test(w)) { var fp = re2.exec(w); stem = fp[1] + fp[2]; re2 = new RegExp(mgr1); if (re2.test(stem)) w = stem; } // Step 5 re = /^(.+?)e$/; if (re.test(w)) { var fp = re.exec(w); stem = fp[1]; re = new RegExp(mgr1); re2 = new RegExp(meq1); re3 = new RegExp("^" + C + v + "[^aeiouwxy]$"); if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) w = stem; } re = /ll$/; re2 = new RegExp(mgr1); if (re.test(w) && re2.test(w)) { re = /.$/; w = w.replace(re,""); } // and turn initial Y back to y if (firstch == "y") w = firstch.toLowerCase() + w.substr(1); return w; } } /** * Search Module */ var Search = { _index : null, _queued_query : null, _pulse_status : -1, init : function() { var params = $.getQueryParameters(); if (params.q) { var query = params.q[0]; $('input[name="q"]')[0].value = query; this.performSearch(query); } }, loadIndex : function(url) { $.ajax({type: "GET", url: url, data: null, success: null, dataType: "script", cache: true}); }, setIndex : function(index) { var q; this._index = index; if ((q = this._queued_query) !== null) { this._queued_query = null; Search.query(q); } }, hasIndex : function() { return this._index !== null; }, deferQuery : function(query) { this._queued_query = query; }, stopPulse : function() { this._pulse_status = 0; }, startPulse : function() { if (this._pulse_status >= 0) return; function pulse() { Search._pulse_status = (Search._pulse_status + 1) % 4; var dotString = ''; for (var i = 0; i < Search._pulse_status; i++) dotString += '.'; Search.dots.text(dotString); if (Search._pulse_status > -1) window.setTimeout(pulse, 500); }; pulse(); }, /** * perform a search for something */ performSearch : function(query) { // create the required interface elements this.out = $('#search-results'); this.title = $('

' + _('Searching') + '

').appendTo(this.out); this.dots = $('').appendTo(this.title); this.status = $('

').appendTo(this.out); this.output = $('h!hh"h%h'hh)}q(hhh.]h-]h+]h,]h0]uh2KEh3hh]qh {% if artworks %}
  • {% trans 'Artworks' %}
  • {% for artwork in artworks %}
  • {% if artwork.first_image %} {% endif %} {{ artwork }}
  • {% endfor %} {% endif %} {% if artists %}
  • {% trans 'Artists' %}
  • {% for artist in artists %}
  • {% if artist.image %} {% endif %} {{ artist }}
  • {% endfor %} {% endif %} {# more ...} {% if not options %}
  • {% trans 'No options' %}
  • {% blocktrans %}Search for {{ q }}{% endblocktrans %}
  • {% endif %} q؅q}q(h Uh!hubaubh@)q}q(h XIn this template, my option selector is simply 'li:has(a)'. So every tag that is in an li with an a tag will be considered as a valid option by the autocomplete.qh!hh"h%h'hCh)}q(h+]h,]h-]h.]h0]uh2Koh3hh]qh tag that is in an li with an a tag will be considered as a valid option by the autocomplete.qq}q(h hh!hubaubh@)q}q(h X$As for the url, it looks like this::qh!hh"h%h'hCh)}q(h+]h,]h-]h.]h0]uh2Krh3hh]qhh!hh"h%h'hh)}r(hhh.]h-]h+]h,]h0]uh2Kh3hh]rhrr}r(h Uh!jubaubh@)r}r(h XdOf course, if you have haystack or any kind of search, you could use it as well, it doesn't matter::h!hh"h%h'hCh)}r(h+]h,]h-]h.]h0]uh2Kh3hh]rh {{ search_form.q }} h!hh"h%h'hh)}r(hhh.]h-]h+]h,]h0]uh2Kh3hh]r h {{ search_form.q }} r!r"}r#(h Uh!jubaubeubh)r$}r%(h Uh!hh"h%h'h(h)}r&(h+]h,]h-]h.]r'hah0]r(hauh2Kh3hh]r)(h5)r*}r+(h XLoading the scriptr,h!j$h"h%h'h9h)}r-(h+]h,]h-]h.]h0]uh2Kh3hh]r.h h!j$h"h%h'hh)}r;(hhh.]h-]h+]h,]h0]uh2Kh3hh]r<h r=r>}r?(h Uh!j9ubaubeubh)r@}rA(h Uh!hh"h%h'h(h)}rB(h+]h,]h-]h.]rChah0]rDh auh2Kh3hh]rE(h5)rF}rG(h X Script usagerHh!j@h"h%h'h9h)}rI(h+]h,]h-]h.]h0]uh2Kh3hh]rJh $(document).ready(function() { $('input#main_autocomplete').yourlabs_autocomplete({ url: '{% url project_specific_autocomplete %}', zindex: 99999, id: 'main_autocomplete', iterablesSelector: 'li:has(a)', defaultValue: "{% trans 'Search : an artwork, an artist, a user, a contact...' %}", }); }); h!j@h"h%h'hh)}rW(hhh.]h-]h+]h,]h0]uh2Kh3hh]rXh $(document).ready(function() { $('input#main_autocomplete').yourlabs_autocomplete({ url: '{% url project_specific_autocomplete %}', zindex: 99999, id: 'main_autocomplete', iterablesSelector: 'li:has(a)', defaultValue: "{% trans 'Search : an artwork, an artist, a user, a contact...' %}", }); }); rYrZ}r[(h Uh!jUubaubh@)r\}r](h XThere are other options. If these don't work very well for you, you should read autocomplete.js. It's not a fat bloated script like jQueryUi autocomplete with tons of dependencies, so it shouldn't be that hard to figure it out.r^h!j@h"h%h'hCh)}r_(h+]h,]h-]h.]h0]uh2Kh3hh]r`h $(document).ready(function() { $('#search_bloc input[name=q]').bind('yourlabs_autocomplete.selectOption', function(e, option) { var autocomplete = $(this).yourlabs_autocomplete(); // hide the autocomplete autocomplete.hide(); // change the input's value to 'loading page: some page' autocomplete.el.val('{% trans 'loading page' %}: ' + $.trim(option.text())); // find the url of the option link = $(option).find('a:first'); // if the link looks good if (link.length && link.attr('href') != undefined) { // open the link window.location.href = link.attr('href'); return false; } else { // that should only happen during development !! alert('sorry, i dunno what to do with your selection!!'); } }); }); h!j@h"h%h'hh)}rm(hhh.]h-]h+]h,]h0]uh2Kh3hh]rnh $(document).ready(function() { $('#search_bloc input[name=q]').bind('yourlabs_autocomplete.selectOption', function(e, option) { var autocomplete = $(this).yourlabs_autocomplete(); // hide the autocomplete autocomplete.hide(); // change the input's value to 'loading page: some page' autocomplete.el.val('{% trans 'loading page' %}: ' + $.trim(option.text())); // find the url of the option link = $(option).find('a:first'); // if the link looks good if (link.length && link.attr('href') != undefined) { // open the link window.location.href = link.attr('href'); return false; } else { // that should only happen during development !! alert('sorry, i dunno what to do with your selection!!'); } }); }); rorp}rq(h Uh!jkubaubh@)rr}rs(h XThat's all folks ! Enjoy your fine global navigation autocomplete. Personnaly I think there should be one in the header of every project, it is just **so** convenient for the user. And if nicely designed, it is very 'web 2.0' whatever it means hahah.h!j@h"h%h'hCh)}rt(h+]h,]h-]h.]h0]uh2Kh3hh]ru(hh4XThe app is was developed for Django 1.4. However, there are workarounds to get it to work with Django 1.3 too. This document attemps to provide an exhaustive list of notes that should be taken in account when using the app with django-autocomplete-light.q?q@}qA(hh;hh9ubaubh)qB}qC(hUhhhhhh h!}qD(h#]h$]h%]h&]qEhah(]qFhauh*K h+hh]qG(h-)qH}qI(hXmodelform_factoryqJhhBhhhh1h!}qK(h#]h$]h%]h&]h(]uh*K h+hh]qLh4Xmodelform_factoryqMqN}qO(hhJhhHubaubh8)qP}qQ(hXyThe provided autocomplete_light.modelform_factory relies on Django 1.4's modelform_factory that accepts a 'widgets' dict.qRhhBhhhhXdjango-autocomplete-light demoq?q@}qA(h"h:h#h8ubaubcdocutils.nodes paragraph qB)qC}qD(h"XbThe test_project lives in the test_project subdirectory of django-autocomplete-light's repository.qEh#h h$h'h)U paragraphqFh+}qG(h-]h.]h/]h0]h2]uh4Kh5hh]qHh>XbThe test_project lives in the test_project subdirectory of django-autocomplete-light's repository.qIqJ}qK(h"hEh#hCubaubh)qL}qM(h"Uh#h h$h'h)h*h+}qN(h-]h.]h/]h0]qOhah2]qPh auh4Kh5hh]qQ(h7)qR}qS(h"XInstallqTh#hLh$h'h)h;h+}qU(h-]h.]h/]h0]h2]uh4Kh5hh]qVh>XInstallqWqX}qY(h"hTh#hRubaubhB)qZ}q[(h"XWe're going to use virtualenv, so that we don't pollute your system when installing dependencies. If you don't already have virtualenv, you can install it either via your package manager, either via python's package manager with something like::h#hLh$h%X../../test_project/INSTALL.rstq\q]}q^bh)hFh+}q_(h-]h.]h/]h0]h2]uh4Kh5hh]q`h>XWe're going to use virtualenv, so that we don't pollute your system when installing dependencies. If you don't already have virtualenv, you can install it either via your package manager, either via python's package manager with something like:qaqb}qc(h"XWe're going to use virtualenv, so that we don't pollute your system when installing dependencies. If you don't already have virtualenv, you can install it either via your package manager, either via python's package manager with something like:h#hZubaubcdocutils.nodes literal_block qd)qe}qf(h"Xsudo easy_install virtualenvh#hLh$h]h)U literal_blockqgh+}qh(U xml:spaceqiUpreserveqjh0]h/]h-]h.]h2]uh4Kh5hh]qkh>Xsudo easy_install virtualenvqlqm}qn(h"Uh#heubaubhB)qo}qp(h"XInstall last release::qqh#hLh$h]h)hFh+}qr(h-]h.]h/]h0]h2]uh4Kh5hh]qsh>XInstall last release:qtqu}qv(h"XInstall last release:h#houbaubhd)qw}qx(h"X/rm -rf django-autocomplete-light autocomplete_light_env/ virtualenv autocomplete_light_env source autocomplete_light_env/bin/activate git clone https://jpic@github.com/yourlabs/django-autocomplete-light.git cd django-autocomplete-light/test_project pip install -r requirements.txt ./manage.py runserverh#hLh$h]h)hgh+}qy(hihjh0]h/]h-]h.]h2]uh4Kh5hh]qzh>X/rm -rf django-autocomplete-light autocomplete_light_env/ virtualenv autocomplete_light_env source autocomplete_light_env/bin/activate git clone https://jpic@github.com/yourlabs/django-autocomplete-light.git cd django-autocomplete-light/test_project pip install -r requirements.txt ./manage.py runserverq{q|}q}(h"Uh#hwubaubhB)q~}q(h"X@Install development versions, if you want to contribute hehehe::qh#hLh$h]h)hFh+}q(h-]h.]h/]h0]h2]uh4Kh5hh]qh>X?Install development versions, if you want to contribute hehehe:qq}q(h"X?Install development versions, if you want to contribute hehehe:h#h~ubaubhd)q}q(h"X AUTOCOMPLETE_LIGHT_VERSION="master" CITIES_LIGHT_VERSION="master" rm -rf autocomplete_light_env/ virtualenv autocomplete_light_env source autocomplete_light_env/bin/activate pip install -e git+git://github.com/yourlabs/django-cities-light.git@$CITIES_LIGHT_VERSION#egg=cities_light pip install -e git+git://github.com/yourlabs/django-autocomplete-light.git@$AUTOCOMPLETE_LIGHT_VERSION#egg=autocomplete_light cd autocomplete_light_env/src/autocomplete-light/test_project pip install -r requirements.txt ./manage.py runserverh#hLh$h]h)hgh+}q(hihjh0]h/]h-]h.]h2]uh4K!h5hh]qh>X AUTOCOMPLETE_LIGHT_VERSION="master" CITIES_LIGHT_VERSION="master" rm -rf autocomplete_light_env/ virtualenv autocomplete_light_env source autocomplete_light_env/bin/activate pip install -e git+git://github.com/yourlabs/django-cities-light.git@$CITIES_LIGHT_VERSION#egg=cities_light pip install -e git+git://github.com/yourlabs/django-autocomplete-light.git@$AUTOCOMPLETE_LIGHT_VERSION#egg=autocomplete_light cd autocomplete_light_env/src/autocomplete-light/test_project pip install -r requirements.txt ./manage.py runserverqq}q(h"Uh#hubaubhB)q}q(h"X+Login with user "test" and password "test".qh#hLh$h]h)hFh+}q(h-]h.]h/]h0]h2]uh4K"h5hh]qh>X+Login with user "test" and password "test".qq}q(h"hh#hubaubhB)q}q(h"XGIf you want to redo the database, but make sure you read README first::qh#hLh$h]h)hFh+}q(h-]h.]h/]h0]h2]uh4K$h5hh]qh>XFIf you want to redo the database, but make sure you read README first:qq}q(h"XFIf you want to redo the database, but make sure you read README first:h#hubaubhd)q}q(h"X8rm db.sqlite ./manage.py syncdb ./manage.py cities_lighth#hLh$X5internal padding after ../../test_project/INSTALL.rstqh)hgh+}q(hihjh0]h/]h-]h.]h2]uh4K2h5hh]qh>X8rm db.sqlite ./manage.py syncdb ./manage.py cities_lightqq}q(h"Uh#hubaubeubh)q}q(h"Uh#h h$h'h)h*h+}q(h-]h.]h/]h0]qhah2]qh auh4K h5hh]q(h7)q}q(h"XTry basic featuresqh#hh$h'h)h;h+}q(h-]h.]h/]h0]h2]uh4K h5hh]qh>XTry basic featuresqq}q(h"hh#hubaubhB)q}q(h"XOnce you have the test_project server running (see INSTALL if you don't), open `the first contact `_.h#hh$h%X../../test_project/README.rstqq}qbh)hFh+}q(h-]h.]h/]h0]h2]uh4Kh5hh]q(h>XOOnce you have the test_project server running (see INSTALL if you don't), open qq}q(h"XOOnce you have the test_project server running (see INSTALL if you don't), open h#hubcdocutils.nodes reference q)q}q(h"XN`the first contact `_h+}q(UnameXthe first contactUrefuriqX7http://localhost:8000/admin/project_specific/contact/1/qh0]h/]h-]h.]h2]uh#hh]qh>Xthe first contactqąq}q(h"Uh#hubah)U referencequbcdocutils.nodes target q)q}q(h"X: U referencedqKh#hh)Utargetqh+}q(Urefurihh0]qhah/]h-]h.]h2]qhauh]ubh>X.q}q(h"X.h#hubeubhB)q}q(h"XYou will see two addresses:qh#hh$hh)hFh+}q(h-]h.]h/]h0]h2]uh4Kh5hh]qh>XYou will see two addresses:qׅq}q(h"hh#hubaubcdocutils.nodes bullet_list q)q}q(h"Uh#hh$hh)U bullet_listqh+}q(UbulletqX-h0]h/]h-]h.]h2]uh4Kh5hh]q(cdocutils.nodes list_item q)q}q(h"Xone at Paris, Franceqh#hh$hh)U list_itemqh+}q(h-]h.]h/]h0]h2]uh4Nh5hh]qhB)q}q(h"hh#hh$hh)hFh+}q(h-]h.]h/]h0]h2]uh4Kh]qh>Xone at Paris, Franceq셁q}q(h"hh#hubaubaubh)q}q(h"Xone at Paris, United States h#hh$hh)hh+}q(h-]h.]h/]h0]h2]uh4Nh5hh]qhB)q}q(h"Xone at Paris, United Statesqh#hh$hh)hFh+}q(h-]h.]h/]h0]h2]uh4Kh]qh>Xone at Paris, United Statesqq}q(h"hh#hubaubaubeubhB)q}q(h"XThe reason for that is that there are several cities in the world with the name "Paris". This is the reason why the double autocomplete widget is interresting: it filters the cities based on the selected country.qh#hh$hh)hFh+}q(h-]h.]h/]h0]h2]uh4K h5hh]qh>XThe reason for that is that there are several cities in the world with the name "Paris". This is the reason why the double autocomplete widget is interresting: it filters the cities based on the selected country.rr}r(h"hh#hubaubhB)r}r(h"XLNote that only cities from France, USA and Belgium are in the demo database.rh#hh$hh)hFh+}r(h-]h.]h/]h0]h2]uh4Kh5hh]rh>XLNote that only cities from France, USA and Belgium are in the demo database.rr }r (h"jh#jubaubhB)r }r (h"XRNote that you can test autocompletes for generic foreign keys in this project too.r h#hh$hh)hFh+}r(h-]h.]h/]h0]h2]uh4Kh5hh]rh>XRNote that you can test autocompletes for generic foreign keys in this project too.rr}r(h"j h#j ubaubeubh)r}r(h"Uh#h h$h'h)h*h+}r(h-]h.]h/]h0]rhah2]rh auh4Kh5hh]r(h7)r}r(h"XTry advanced featuresrh#jh$h'h)h;h+}r(h-]h.]h/]h0]h2]uh4Kh5hh]rh>XTry advanced featuresrr}r (h"jh#jubaubhB)r!}r"(h"XoAssuming you installed the test_project, all you need in addition is to install requirements for this project::h#jh$h%X"../../test_api_project/INSTALL.rstr#r$}r%bh)hFh+}r&(h-]h.]h/]h0]h2]uh4Kh5hh]r'h>XnAssuming you installed the test_project, all you need in addition is to install requirements for this project:r(r)}r*(h"XnAssuming you installed the test_project, all you need in addition is to install requirements for this project:h#j!ubaubhd)r+}r,(h"Xacd autocomplete_light_env/src/autocomplete-light/test_api_project pip install -r requirements.txth#jh$j$h)hgh+}r-(hihjh0]h/]h-]h.]h2]uh4KWh5hh]r.h>Xacd autocomplete_light_env/src/autocomplete-light/test_api_project pip install -r requirements.txtr/r0}r1(h"Uh#j+ubaubhB)r2}r3(h"X)Then, refer to README.rst in this folder.r4h#jh$j$h)hFh+}r5(h-]h.]h/]h0]h2]uh4Kh5hh]r6h>X)Then, refer to README.rst in this folder.r7r8}r9(h"j4h#j2ubaubhB)r:}r;(h"XThis project demonstrates how the autocomplete can suggest results from a remote API - and thus which don't have a pk in the local database.r<h#jh$h%X!../../test_api_project/README.rstr=r>}r?bh)hFh+}r@(h-]h.]h/]h0]h2]uh4Kh5hh]rAh>XThis project demonstrates how the autocomplete can suggest results from a remote API - and thus which don't have a pk in the local database.rBrC}rD(h"j<h#j:ubaubhB)rE}rF(h"XIn one console::rGh#jh$j>h)hFh+}rH(h-]h.]h/]h0]h2]uh4Kh5hh]rIh>XIn one console:rJrK}rL(h"XIn one console:h#jEubaubhd)rM}rN(h"X%cd test_project ./manage.py runserverh#jh$j>h)hgh+}rO(hihjh0]h/]h-]h.]h2]uh4Kch5hh]rPh>X%cd test_project ./manage.py runserverrQrR}rS(h"Uh#jMubaubhB)rT}rU(h"X In another::rVh#jh$j>h)hFh+}rW(h-]h.]h/]h0]h2]uh4K h5hh]rXh>X In another:rYrZ}r[(h"X In another:h#jTubaubhd)r\}r](h"X8cd test_api_project ./manage.py runserver 127.0.0.1:8001h#jh$j>h)hgh+}r^(hihjh0]h/]h-]h.]h2]uh4Khh5hh]r_h>X8cd test_api_project ./manage.py runserver 127.0.0.1:8001r`ra}rb(h"Uh#j\ubaubhB)rc}rd(h"X;In http://localhost:8001/admin, you should be able to test:reh#jh$j>h)hFh+}rf(h-]h.]h/]h0]h2]uh4Kh5hh]rg(h>XIn rhri}rj(h"XIn h#jcubh)rk}rl(h"Xhttp://localhost:8001/adminrmh+}rn(Urefurijmh0]h/]h-]h.]h2]uh#jch]roh>Xhttp://localhost:8001/adminrprq}rr(h"Uh#jkubah)hubh>X, you should be able to test:rsrt}ru(h"X, you should be able to test:h#jcubeubh)rv}rw(h"Uh#jh$j>h)hh+}rx(hX-h0]h/]h-]h.]h2]uh4Kh5hh]ry(h)rz}r{(h"X.compatibility with django-admintools-bootstrapr|h#jvh$j>h)hh+}r}(h-]h.]h/]h0]h2]uh4Nh5hh]r~hB)r}r(h"j|h#jzh$j>h)hFh+}r(h-]h.]h/]h0]h2]uh4Kh]rh>X.compatibility with django-admintools-bootstraprr}r(h"j|h#jubaubaubh)r}r(h"Xgeneric fk autocompleterh#jvh$j>h)hh+}r(h-]h.]h/]h0]h2]uh4Nh5hh]rhB)r}r(h"jh#jh$j>h)hFh+}r(h-]h.]h/]h0]h2]uh4Kh]rh>Xgeneric fk autocompleterr}r(h"jh#jubaubaubh)r}r(h"Xgeneric m2m autocompleterh#jvh$j>h)hh+}r(h-]h.]h/]h0]h2]uh4Nh5hh]rhB)r}r(h"jh#jh$j>h)hFh+}r(h-]h.]h/]h0]h2]uh4Kh]rh>Xgeneric m2m autocompleterr}r(h"jh#jubaubaubh)r}r(h"XWremote api autocomplete (cities/countries are suggested and imported from test_project)h#jvh$j>h)hh+}r(h-]h.]h/]h0]h2]uh4Nh5hh]rhB)r}r(h"XWremote api autocomplete (cities/countries are suggested and imported from test_project)rh#jh$j>h)hFh+}r(h-]h.]h/]h0]h2]uh4Kh]rh>XWremote api autocomplete (cities/countries are suggested and imported from test_project)rr}r(h"jh#jubaubaubh)r}r(h"X4autocompletes in inlines, dual widget, etc, etc ... h#jvh$j>h)hh+}r(h-]h.]h/]h0]h2]uh4Nh5hh]rhB)r}r(h"X3autocompletes in inlines, dual widget, etc, etc ...rh#jh$j>h)hFh+}r(h-]h.]h/]h0]h2]uh4Kh]rh>X3autocompletes in inlines, dual widget, etc, etc ...rr}r(h"jh#jubaubaubeubhB)r}r(h"XIf you're not going to use localhost:8000 for test_project, then you should update source urls in `test_api_project/test_api_project/autocomplete_light_registry.py`.h#jh$j>h)hFh+}r(h-]h.]h/]h0]h2]uh4Kh5hh]r(h>XbIf you're not going to use localhost:8000 for test_project, then you should update source urls in rr}r(h"XbIf you're not going to use localhost:8000 for test_project, then you should update source urls in h#jubcdocutils.nodes title_reference r)r}r(h"XB`test_api_project/test_api_project/autocomplete_light_registry.py`h+}r(h-]h.]h/]h0]h2]uh#jh]rh>X@test_api_project/test_api_project/autocomplete_light_registry.pyrr}r(h"Uh#jubah)Utitle_referencerubh>X.r}r(h"X.h#jubeubhB)r}r(h"XNow, note that there are `no or few countries in test_api_project database `_.h#jh$j>h)hFh+}r(h-]h.]h/]h0]h2]uh4Kh5hh]r(h>XNow, note that there are rr}r(h"XNow, note that there are h#jubh)r}r(h"Xg`no or few countries in test_api_project database `_h+}r(UnameX0no or few countries in test_api_project databasehX1http://localhost:8001/admin/cities_light/country/rh0]h/]h-]h.]h2]uh#jh]rh>X0no or few countries in test_api_project databaserr}r(h"Uh#jubah)hubh)r}r(h"X4 hKh#jh)hh+}r(Urefurijh0]rhah/]h-]h.]h2]rh auh]ubh>X.r}r(h"X.h#jubeubhB)r}r(h"XAgain, test_project's database only includes countries France, Belgium and America so there's no need to try the other one unless you know what you're doing.rh#jh$j>h)hFh+}r(h-]h.]h/]h0]h2]uh4Kh5hh]rh>XAgain, test_project's database only includes countries France, Belgium and America so there's no need to try the other one unless you know what you're doing.rr}r(h"jh#jubaubhB)r}r(h"XAlso note that, city and country autocomplete `work the same `_. The reason for that is that test_api_project uses City and Country remote channel to add results to the autocomplete that are not in the local database.h#jh$j>h)hFh+}r(h-]h.]h/]h0]h2]uh4K"h5hh]r(h>X.Also note that, city and country autocomplete rr}r(h"X.Also note that, city and country autocomplete h#jubh)r}r(h"XL`work the same `_h+}r(UnameX work the samehX9http://localhost:8001/admin/project_specific/contact/add/rh0]h/]h-]h.]h2]uh#jh]rh>X work the samerr}r(h"Uh#jubah)hubh)r}r(h"X< hKh#jh)hh+}r(Urefurijh0]rhah/]h-]h.]h2]rhauh]ubh>X. The reason for that is that test_api_project uses City and Country remote channel to add results to the autocomplete that are not in the local database.rr}r(h"X. The reason for that is that test_api_project uses City and Country remote channel to add results to the autocomplete that are not in the local database.h#jubeubeubeubah"UU transformerrNU footnote_refsr}rUrefnamesr}rUsymbol_footnotesr]rUautofootnote_refsr]rUsymbol_footnote_refsr]rU citationsr]r h5hU current_liner NUtransform_messagesr ]r Ureporterr NUid_startrKU autofootnotesr]rU citation_refsr}rUindirect_targetsr]rUsettingsr(cdocutils.frontend Values ror}r(Ufootnote_backlinksrKUrecord_dependenciesrNU rfc_base_urlrUhttp://tools.ietf.org/html/rU tracebackrUpep_referencesrNUstrip_commentsrNU toc_backlinksr Uentryr!U language_coder"Uenr#U datestampr$NU report_levelr%KU _destinationr&NU halt_levelr'KU strip_classesr(Nh;NUerror_encoding_error_handlerr)Ubackslashreplacer*Udebugr+NUembed_stylesheetr,Uoutput_encoding_error_handlerr-Ustrictr.U sectnum_xformr/KUdump_transformsr0NU docinfo_xformr1KUwarning_streamr2NUpep_file_url_templater3Upep-%04dr4Uexit_status_levelr5KUconfigr6NUstrict_visitorr7NUcloak_email_addressesr8Utrim_footnote_reference_spacer9Uenvr:NUdump_pseudo_xmlr;NUexpose_internalsr<NUsectsubtitle_xformr=U source_linkr>NUrfc_referencesr?NUoutput_encodingr@Uutf-8rAU source_urlrBNUinput_encodingrCU utf-8-sigrDU_disable_configrENU id_prefixrFUU tab_widthrGKUerror_encodingrHUasciirIU_sourcerJU/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/docs/source/demo.rstrKUgettext_compactrLU generatorrMNUdump_internalsrNNU pep_base_urlrOUhttp://www.python.org/dev/peps/rPUsyntax_highlightrQUshortrRUinput_encoding_error_handlerrSj.Uauto_id_prefixrTUidrUUdoctitle_xformrVUstrip_elements_with_classesrWNU _config_filesrX]Ufile_insertion_enabledrYKU raw_enabledrZKU dump_settingsr[NubUsymbol_footnote_startr\KUidsr]}r^(hhhjhhhh hjhhLhjuUsubstitution_namesr_}r`h)h5h+}ra(h-]h0]h/]Usourceh'h.]h2]uU footnotesrb]rcUrefidsrd}reub.PK6@6django-autocomplete-light-0.8/.doctrees/remote.doctreecdocutils.nodes document q)q}q(U nametypesq}q(XGautocomplete_light.channel.remote.RemoteChannelBase.get_source_url_dataqXBautocomplete_light.channel.remote.RemoteChannelBase.result_as_dictqXremoteqXjavascript funq NX#proposing results from a remote apiq NXHautocomplete_light.channel.remote.RemoteChannelBase.model_for_source_urlq Xremote-exampleq X@autocomplete_light.channel.remote.RemoteChannelBase.fetch_resultq XCautocomplete_light.channel.remote.RemoteChannelBase.result_as_valueqXFautocomplete_light.channel.remote.RemoteChannelBase.get_remote_resultsqXjavascript-funqXapiqNXBautocomplete_light.channel.remote.RemoteChannelBase.get_source_urlqX8autocomplete_light.channel.remote.RemoteChannelBase.postqX?autocomplete_light.channel.remote.RemoteChannelBase.get_resultsqX9autocomplete_light.channel.remote.RemoteChannelBase.fetchqXexampleqNX3autocomplete_light.channel.remote.RemoteChannelBasequUsubstitution_defsq}qUparse_messagesq]qUcurrent_sourceqNU decorationqNUautofootnote_startqKUnameidsq}q (hhhhhUremoteq!h Uid1q"h U#proposing-results-from-a-remote-apiq#h h h Uremote-exampleq$h h hhhhhUjavascript-funq%hUapiq&hhhhhhhhhUexampleq'hhuUchildrenq(]q)(cdocutils.nodes target q*)q+}q,(U rawsourceq-X .. _remote:Uparentq.hUsourceq/cdocutils.nodes reprunicode q0X/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/docs/source/remote.rstq1q2}q3bUtagnameq4Utargetq5U attributesq6}q7(Uidsq8]Ubackrefsq9]Udupnamesq:]Uclassesq;]Unamesq<]Urefidq=h!uUlineq>KUdocumentq?hh(]ubcdocutils.nodes section q@)qA}qB(h-Uh.hh/h2Uexpect_referenced_by_nameqC}qDhh+sh4UsectionqEh6}qF(h:]h;]h9]h8]qG(h#h!eh<]qH(h heuh>Kh?hUexpect_referenced_by_idqI}qJh!h+sh(]qK(cdocutils.nodes title qL)qM}qN(h-X#Proposing results from a remote APIqOh.hAh/h2h4UtitleqPh6}qQ(h:]h;]h9]h8]h<]uh>Kh?hh(]qRcdocutils.nodes Text qSX#Proposing results from a remote APIqTqU}qV(h-hOh.hMubaubcdocutils.nodes paragraph qW)qX}qY(h-XnThis documentation is optionnal, but it is complementary with all other documentation. It aims advanced users.qZh.hAh/h2h4U paragraphq[h6}q\(h:]h;]h9]h8]h<]uh>Kh?hh(]q]hSXnThis documentation is optionnal, but it is complementary with all other documentation. It aims advanced users.q^q_}q`(h-hZh.hXubaubhW)qa}qb(h-XxConsider a social network about music. In order to propose all songs in the world in its autocomplete, it should either:qch.hAh/h2h4h[h6}qd(h:]h;]h9]h8]h<]uh>K h?hh(]qehSXxConsider a social network about music. In order to propose all songs in the world in its autocomplete, it should either:qfqg}qh(h-hch.haubaubcdocutils.nodes bullet_list qi)qj}qk(h-Uh.hAh/h2h4U bullet_listqlh6}qm(UbulletqnX-h8]h9]h:]h;]h<]uh>K h?hh(]qo(cdocutils.nodes list_item qp)qq}qr(h-X,have a database with all songs of the world,qsh.hjh/h2h4U list_itemqth6}qu(h:]h;]h9]h8]h<]uh>Nh?hh(]qvhW)qw}qx(h-hsh.hqh/h2h4h[h6}qy(h:]h;]h9]h8]h<]uh>K h(]qzhSX,have a database with all songs of the world,q{q|}q}(h-hsh.hwubaubaubhp)q~}q(h-X?use a simple REST API to query a database with all songs world h.hjh/h2h4hth6}q(h:]h;]h9]h8]h<]uh>Nh?hh(]qhW)q}q(h-X>use a simple REST API to query a database with all songs worldqh.h~h/h2h4h[h6}q(h:]h;]h9]h8]h<]uh>K h(]qhSX>use a simple REST API to query a database with all songs worldqq}q(h-hh.hubaubaubeubhW)q}q(h-XThe purpose of this documentation is to describe every elements involved. Note that a living demonstration is available in `test_api_project`, where one project serves a full database of cities via an API to another.h.hAh/h2h4h[h6}q(h:]h;]h9]h8]h<]uh>Kh?hh(]q(hSX{The purpose of this documentation is to describe every elements involved. Note that a living demonstration is available in qq}q(h-X{The purpose of this documentation is to describe every elements involved. Note that a living demonstration is available in h.hubcdocutils.nodes title_reference q)q}q(h-X`test_api_project`h6}q(h:]h;]h9]h8]h<]uh.hh(]qhSXtest_api_projectqq}q(h-Uh.hubah4Utitle_referencequbhSXK, where one project serves a full database of cities via an API to another.qq}q(h-XK, where one project serves a full database of cities via an API to another.h.hubeubh*)q}q(h-X.. _remote-example:h.hAh/h2h4h5h6}q(h8]h9]h:]h;]h<]h=h$uh>Kh?hh(]ubh@)q}q(h-Uh.hAh/h2hC}qh hsh4hEh6}q(h:]h;]h9]h8]q(h'h$eh<]q(hh euh>Kh?hhI}qh$hsh(]q(hL)q}q(h-XExampleqh.hh/h2h4hPh6}q(h:]h;]h9]h8]h<]uh>Kh?hh(]qhSXExampleqq}q(h-hh.hubaubhW)q}q(h-XYIn test_api_project, of course you should not hardcode urls like that in actual projects:qh.hh/h2h4h[h6}q(h:]h;]h9]h8]h<]uh>Kh?hh(]qhSXYIn test_api_project, of course you should not hardcode urls like that in actual projects:qq}q(h-hh.hubaubcdocutils.nodes literal_block q)q}q(h-Ximport autocomplete_light from cities_light.contrib.autocomplete_light_restframework import RemoteCountryChannel, RemoteCityChannel from cities_light.models import City, Country autocomplete_light.register(Country, RemoteCountryChannel, source_url = 'http://localhost:8000/cities_light/country/') autocomplete_light.register(City, RemoteCityChannel, source_url = 'http://localhost:8000/cities_light/city/') h.hh/h2h4U literal_blockqh6}q(Ulanguageqh0Xpythonqq}qbh:]U xml:spaceqUpreserveqh8]h9]UsourceX/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/docs/source/../../test_api_project/test_api_project/autocomplete_light_registry.pyh;]h<]uh>Kh?hh(]qhSXimport autocomplete_light from cities_light.contrib.autocomplete_light_restframework import RemoteCountryChannel, RemoteCityChannel from cities_light.models import City, Country autocomplete_light.register(Country, RemoteCountryChannel, source_url = 'http://localhost:8000/cities_light/country/') autocomplete_light.register(City, RemoteCityChannel, source_url = 'http://localhost:8000/cities_light/city/') qąq}q(h-Uh.hubaubhW)q}q(h-XvCheck out the documentation of :ref:`RemoteCountryChannel and RemoteCityChannel` for more.h.hh/h2h4h[h6}q(h:]h;]h9]h8]h<]uh>Kh?hh(]q(hSXCheck out the documentation of q˅q}q(h-XCheck out the documentation of h.hubcsphinx.addnodes pending_xref q)q}q(h-XM:ref:`RemoteCountryChannel and RemoteCityChannel`qh.hh/h2h4U pending_xrefqh6}q(UreftypeXrefUrefwarnqԈU reftargetqXcitieslight:remote-channelU refdomainXstdqh8]h9]U refexplicith:]h;]h<]UrefdocqUremotequh>Kh(]qcdocutils.nodes emphasis q)q}q(h-hh6}q(h:]h;]q(UxrefqhXstd-refqeh9]h8]h<]uh.hh(]qhSX*RemoteCountryChannel and RemoteCityChannelq⅁q}q(h-Uh.hubah4UemphasisqubaubhSX for more.q慁q}q(h-X for more.h.hubeubeubh@)q}q(h-Uh.hAh/h2h4hEh6}q(h:]h;]h9]h8]q(X(module-autocomplete_light.channel.remoteqh&eh<]qhauh>K!h?hh(]q(hL)q}q(h-XAPIqh.hh/h2h4hPh6}q(h:]h;]h9]h8]h<]uh>K!h?hh(]qhSXAPIqq}q(h-hh.hubaubcsphinx.addnodes index q)q}q(h-Uh.hh/U qh4Uindexqh6}q(h8]h9]h:]h;]h<]Uentries]q(UsingleqX*autocomplete_light.channel.remote (module)X(module-autocomplete_light.channel.remoteUtrauh>Kh?hh(]ubh)r}r(h-Uh.hh/Nh4hh6}r(h8]h9]h:]h;]h<]Uentries]r(hX>RemoteChannelBase (class in autocomplete_light.channel.remote)hUtrauh>Nh?hh(]ubcsphinx.addnodes desc r)r}r(h-Uh.hh/Nh4Udescr h6}r (Unoindexr Udomainr Xpyh8]h9]h:]h;]h<]Uobjtyper XclassrUdesctyperjuh>Nh?hh(]r(csphinx.addnodes desc_signature r)r}r(h-XRemoteChannelBase()rh.jh/U rh4Udesc_signaturerh6}r(h8]rhaUmodulerh0X!autocomplete_light.channel.remoterr}rbh9]h:]h;]h<]rhaUfullnamerXRemoteChannelBaserUclassr UUfirstr!uh>Nh?hh(]r"(csphinx.addnodes desc_annotation r#)r$}r%(h-Xclass h.jh/jh4Udesc_annotationr&h6}r'(h:]h;]h9]h8]h<]uh>Nh?hh(]r(hSXclass r)r*}r+(h-Uh.j$ubaubcsphinx.addnodes desc_addname r,)r-}r.(h-X"autocomplete_light.channel.remote.h.jh/jh4U desc_addnamer/h6}r0(h:]h;]h9]h8]h<]uh>Nh?hh(]r1hSX"autocomplete_light.channel.remote.r2r3}r4(h-Uh.j-ubaubcsphinx.addnodes desc_name r5)r6}r7(h-jh.jh/jh4U desc_namer8h6}r9(h:]h;]h9]h8]h<]uh>Nh?hh(]r:hSXRemoteChannelBaser;r<}r=(h-Uh.j6ubaubcsphinx.addnodes only r>)r?}r@(h-Uh.jh/Nh4UonlyrAh6}rB(UexprUhtmlrCh8]h9]h:]h;]h<]uh>Nh?hh(]rDh)rE}rF(h-Uh6}rG(UreftypeUviewcoderHUrefdochU refdomainUstdrIh8]h9]U refexplicith:]h;]h<]U reftargetX*_modules/autocomplete_light/channel/remoteUrefidjuh.j?h(]rJcdocutils.nodes inline rK)rL}rM(h-Uh6}rN(h:]h;]rOU viewcode-linkrPah9]h8]h<]uh.jEh(]rQhSX[source]rRrS}rT(h-Uh.jLubah4UinlinerUubah4hubaubeubcsphinx.addnodes desc_content rV)rW}rX(h-Uh.jh/jh4U desc_contentrYh6}rZ(h:]h;]h9]h8]h<]uh>Nh?hh(]r[(hW)r\}r](h-XUUses an API to propose suggestions from an HTTP API, tested with djangorestframework.r^h.jWh/X/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/autocomplete_light/channel/remote.py:docstring of autocomplete_light.channel.remote.RemoteChannelBaser_h4h[h6}r`(h:]h;]h9]h8]h<]uh>Kh?hh(]rahSXUUses an API to propose suggestions from an HTTP API, tested with djangorestframework.rbrc}rd(h-j^h.j\ubaubcdocutils.nodes definition_list re)rf}rg(h-Uh.jWh/j_h4Udefinition_listrhh6}ri(h:]h;]h9]h8]h<]uh>Nh?hh(]rj(cdocutils.nodes definition_list_item rk)rl}rm(h-Xmodel_for_source_url A **very important function to override!** take an API URL and return the corresponding model class. This is API specific, there is a complete example in cities_light.contrib. h.jfh/j_h4Udefinition_list_itemrnh6}ro(h:]h;]h9]h8]h<]uh>Kh(]rp(cdocutils.nodes term rq)rr}rs(h-Uh6}rt(h:]h;]h9]h8]h<]uh.jlh(]ruhSXmodel_for_source_urlrvrw}rx(h-Xmodel_for_source_urlryh.jrubah4Utermrzubcdocutils.nodes definition r{)r|}r}(h-Uh6}r~(h:]h;]h9]h8]h<]uh.jlh(]rhW)r}r(h-XA **very important function to override!** take an API URL and return the corresponding model class. This is API specific, there is a complete example in cities_light.contrib.h.j|h/j_h4h[h6}r(h:]h;]h9]h8]h<]uh>Kh(]r(hSXA rr}r(h-XA h.jubcdocutils.nodes strong r)r}r(h-X(**very important function to override!**h6}r(h:]h;]h9]h8]h<]uh.jh(]rhSX$very important function to override!rr}r(h-Uh.jubah4UstrongrubhSX take an API URL and return the corresponding model class. This is API specific, there is a complete example in cities_light.contrib.rr}r(h-X take an API URL and return the corresponding model class. This is API specific, there is a complete example in cities_light.contrib.h.jubeubah4U definitionrubeubjk)r}r(h-XZsource_url The full URL to the list API. For example, to a djangorestframework list view. h.jfh/j_h4jnh6}r(h:]h;]h9]h8]h<]uh>K h?hh(]r(jq)r}r(h-Uh6}r(h:]h;]h9]h8]h<]uh.jh(]rhSX source_urlrr}r(h-X source_urlrh.jubah4jzubj{)r}r(h-Uh6}r(h:]h;]h9]h8]h<]uh.jh(]rhW)r}r(h-XNThe full URL to the list API. For example, to a djangorestframework list view.rh.jh/j_h4h[h6}r(h:]h;]h9]h8]h<]uh>K h(]rhSXNThe full URL to the list API. For example, to a djangorestframework list view.rr}r(h-jh.jubaubah4jubeubeubhW)r}r(h-XZAn example implementation usage is demonstrated in the django-cities-light contrib folder.rh.jWh/j_h4h[h6}r(h:]h;]h9]h8]h<]uh>K h?hh(]rhSXZAn example implementation usage is demonstrated in the django-cities-light contrib folder.rr}r(h-jh.jubaubhW)r}r(h-X$Autocomplete box display chronology:rh.jWh/j_h4h[h6}r(h:]h;]h9]h8]h<]uh>Kh?hh(]rhSX$Autocomplete box display chronology:rr}r(h-jh.jubaubhi)r}r(h-Uh.jWh/j_h4hlh6}r(hnX-h8]h9]h:]h;]h<]uh>Kh?hh(]r(hp)r}r(h-XBautocomplete.js requests autocomplete box to display for an input,rh.jh/j_h4hth6}r(h:]h;]h9]h8]h<]uh>Nh?hh(]rhW)r}r(h-jh.jh/j_h4h[h6}r(h:]h;]h9]h8]h<]uh>Kh(]rhSXBautocomplete.js requests autocomplete box to display for an input,rr}r(h-jh.jubaubaubhp)r}r(h-XBget_results() fetches some extra results via get_remote_results(),rh.jh/j_h4hth6}r(h:]h;]h9]h8]h<]uh>Nh?hh(]rhW)r}r(h-jh.jh/j_h4h[h6}r(h:]h;]h9]h8]h<]uh>Kh(]rhSXBget_results() fetches some extra results via get_remote_results(),rr}r(h-jh.jubaubaubhp)r}r(h-XCget_remote_results() calls source_url and returns a list of models,rh.jh/j_h4hth6}r(h:]h;]h9]h8]h<]uh>Nh?hh(]rhW)r}r(h-jh.jh/j_h4h[h6}r(h:]h;]h9]h8]h<]uh>Kh(]rhSXCget_remote_results() calls source_url and returns a list of models,rr}r(h-jh.jubaubaubhp)r}r(h-Xthe remote results are rendered after the local results in widget.html. It includes some JSON in a hidden textarea, like the API's url for each result. h.jh/j_h4hth6}r(h:]h;]h9]h8]h<]uh>Nh?hh(]rhW)r}r(h-Xthe remote results are rendered after the local results in widget.html. It includes some JSON in a hidden textarea, like the API's url for each result.rh.jh/j_h4h[h6}r(h:]h;]h9]h8]h<]uh>Kh(]rhSXthe remote results are rendered after the local results in widget.html. It includes some JSON in a hidden textarea, like the API's url for each result.rr}r(h-jh.jubaubaubeubhW)r}r(h-X#Remote result selection chronology:rh.jWh/j_h4h[h6}r(h:]h;]h9]h8]h<]uh>Kh?hh(]rhSX#Remote result selection chronology:rr}r(h-jh.jubaubhi)r}r(h-Uh.jWh/j_h4hlh6}r(hnX-h8]h9]h:]h;]h<]uh>Kh?hh(]r(hp)r}r(h-XAdeck.js calls remoteGetValue() instead of the default getValue(),rh.jh/j_h4hth6}r(h:]h;]h9]h8]h<]uh>Nh?hh(]rhW)r}r(h-jh.jh/j_h4h[h6}r(h:]h;]h9]h8]h<]uh>Kh(]rhSXAdeck.js calls remoteGetValue() instead of the default getValue(),rr}r(h-jh.jubaubaubhp)r}r (h-X?remoteGetValue() posts the json from the result to ChannelView,r h.jh/j_h4hth6}r (h:]h;]h9]h8]h<]uh>Nh?hh(]r hW)r }r(h-j h.jh/j_h4h[h6}r(h:]h;]h9]h8]h<]uh>Kh(]rhSX?remoteGetValue() posts the json from the result to ChannelView,rr}r(h-j h.j ubaubaubhp)r}r(h-XEChannelView.post() does its job of proxying RemoteChannelBase.post(),rh.jh/j_h4hth6}r(h:]h;]h9]h8]h<]uh>Nh?hh(]rhW)r}r(h-jh.jh/j_h4h[h6}r(h:]h;]h9]h8]h<]uh>Kh(]rhSXEChannelView.post() does its job of proxying RemoteChannelBase.post(),rr}r(h-jh.jubaubaubhp)r }r!(h-XRemoteChannelBase.post() returns an http response which body is just the pk of the result in the local database, using self.fetch_result(),h.jh/j_h4hth6}r"(h:]h;]h9]h8]h<]uh>Nh?hh(]r#hW)r$}r%(h-XRemoteChannelBase.post() returns an http response which body is just the pk of the result in the local database, using self.fetch_result(),r&h.j h/j_h4h[h6}r'(h:]h;]h9]h8]h<]uh>Kh(]r(hSXRemoteChannelBase.post() returns an http response which body is just the pk of the result in the local database, using self.fetch_result(),r)r*}r+(h-j&h.j$ubaubaubhp)r,}r-(h-Xself.fetch_result() passes the API url of the result and recursively saves the remote models into the local database, returning the id of the newly created object. h.jh/j_h4hth6}r.(h:]h;]h9]h8]h<]uh>Nh?hh(]r/hW)r0}r1(h-Xself.fetch_result() passes the API url of the result and recursively saves the remote models into the local database, returning the id of the newly created object.r2h.j,h/j_h4h[h6}r3(h:]h;]h9]h8]h<]uh>K h(]r4hSXself.fetch_result() passes the API url of the result and recursively saves the remote models into the local database, returning the id of the newly created object.r5r6}r7(h-j2h.j0ubaubaubeubhW)r8}r9(h-X;Set result_template and autocomplete_template if necessary.r:h.jWh/j_h4h[h6}r;(h:]h;]h9]h8]h<]uh>K$h?hh(]r<hSX;Set result_template and autocomplete_template if necessary.r=r>}r?(h-j:h.j8ubaubh)r@}rA(h-Uh.jWh/X/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/autocomplete_light/channel/remote.py:docstring of autocomplete_light.channel.remote.RemoteChannelBase.fetchrBh4hh6}rC(h8]h9]h:]h;]h<]Uentries]rD(hXDfetch() (autocomplete_light.channel.remote.RemoteChannelBase method)hUtrEauh>Nh?hh(]ubj)rF}rG(h-Uh.jWh/jBh4j h6}rH(j j Xpyh8]h9]h:]h;]h<]j XmethodrIjjIuh>Nh?hh(]rJ(j)rK}rL(h-XRemoteChannelBase.fetch(url)h.jFh/jh4jh6}rM(h8]rNhajh0X!autocomplete_light.channel.remoterOrP}rQbh9]h:]h;]h<]rRhajXRemoteChannelBase.fetchrSj jj!uh>Nh?hh(]rT(j5)rU}rV(h-Xfetchh.jKh/jh4j8h6}rW(h:]h;]h9]h8]h<]uh>Nh?hh(]rXhSXfetchrYrZ}r[(h-Uh.jUubaubcsphinx.addnodes desc_parameterlist r\)r]}r^(h-Uh.jKh/jh4Udesc_parameterlistr_h6}r`(h:]h;]h9]h8]h<]uh>Nh?hh(]racsphinx.addnodes desc_parameter rb)rc}rd(h-Xurlh6}re(h:]h;]h9]h8]h<]uh.j]h(]rfhSXurlrgrh}ri(h-Uh.jcubah4Udesc_parameterrjubaubj>)rk}rl(h-Uh.jKh/Nh4jAh6}rm(UexprjCh8]h9]h:]h;]h<]uh>Nh?hh(]rnh)ro}rp(h-Uh6}rq(UreftypejHUrefdochU refdomainjIh8]h9]U refexplicith:]h;]h<]U reftargetX*_modules/autocomplete_light/channel/remoteUrefidjSuh.jkh(]rrjK)rs}rt(h-Uh6}ru(h:]h;]rvjPah9]h8]h<]uh.joh(]rwhSX[source]rxry}rz(h-Uh.jsubah4jUubah4hubaubeubjV)r{}r|(h-Uh.jFh/jh4jYh6}r}(h:]h;]h9]h8]h<]uh>Nh?hh(]r~(hW)r}r(h-XXGiven an url to a remote object, return the corresponding model from the local database.rh.j{h/jBh4h[h6}r(h:]h;]h9]h8]h<]uh>Kh?hh(]rhSXXGiven an url to a remote object, return the corresponding model from the local database.rr}r(h-jh.jubaubhW)r}r(h-XbThe default implementation expects url to respond with a JSON dict of the attributes of an object.rh.j{h/jBh4h[h6}r(h:]h;]h9]h8]h<]uh>Kh?hh(]rhSXbThe default implementation expects url to respond with a JSON dict of the attributes of an object.rr}r(h-jh.jubaubhW)r}r(h-XFor relation attributes, it expect the value to be another url that will respond with a JSON dict of the attributes of the related object.rh.j{h/jBh4h[h6}r(h:]h;]h9]h8]h<]uh>Kh?hh(]rhSXFor relation attributes, it expect the value to be another url that will respond with a JSON dict of the attributes of the related object.rr}r(h-jh.jubaubhW)r}r(h-XxIt calls model_for_source_url() to find which model class corresponds to which url. This allows fetch() to be recursive.rh.j{h/jBh4h[h6}r(h:]h;]h9]h8]h<]uh>K h?hh(]rhSXxIt calls model_for_source_url() to find which model class corresponds to which url. This allows fetch() to be recursive.rr}r(h-jh.jubaubeubeubh)r}r(h-Uh.jWh/X/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/autocomplete_light/channel/remote.py:docstring of autocomplete_light.channel.remote.RemoteChannelBase.fetch_resultrh4hh6}r(h8]h9]h:]h;]h<]Uentries]r(hXKfetch_result() (autocomplete_light.channel.remote.RemoteChannelBase method)h Utrauh>Nh?hh(]ubj)r}r(h-Uh.jWh/jh4j h6}r(j j Xpyh8]h9]h:]h;]h<]j Xmethodrjjuh>Nh?hh(]r(j)r}r(h-X&RemoteChannelBase.fetch_result(result)h.jh/jh4jh6}r(h8]rh ajh0X!autocomplete_light.channel.remoterr}rbh9]h:]h;]h<]rh ajXRemoteChannelBase.fetch_resultrj jj!uh>Nh?hh(]r(j5)r}r(h-X fetch_resulth.jh/jh4j8h6}r(h:]h;]h9]h8]h<]uh>Nh?hh(]rhSX fetch_resultrr}r(h-Uh.jubaubj\)r}r(h-Uh.jh/jh4j_h6}r(h:]h;]h9]h8]h<]uh>Nh?hh(]rjb)r}r(h-Xresulth6}r(h:]h;]h9]h8]h<]uh.jh(]rhSXresultrr}r(h-Uh.jubah4jjubaubj>)r}r(h-Uh.jh/Nh4jAh6}r(UexprjCh8]h9]h:]h;]h<]uh>Nh?hh(]rh)r}r(h-Uh6}r(UreftypejHUrefdochU refdomainjIh8]h9]U refexplicith:]h;]h<]U reftargetX*_modules/autocomplete_light/channel/remoteUrefidjuh.jh(]rjK)r}r(h-Uh6}r(h:]h;]rjPah9]h8]h<]uh.jh(]rhSX[source]rr}r(h-Uh.jubah4jUubah4hubaubeubjV)r}r(h-Uh.jh/jh4jYh6}r(h:]h;]h9]h8]h<]uh>Nh?hh(]r(hW)r}r(h-X]Take a result's dict representation, return it's local pk which might have been just created.rh.jh/jh4h[h6}r(h:]h;]h9]h8]h<]uh>Kh?hh(]rhSX]Take a result's dict representation, return it's local pk which might have been just created.rr}r(h-jh.jubaubhW)r}r(h-XIf your channel works with 0 to 1 API call, consider overriding this method. If your channel is susceptible of using several different API calls, consider overriding fetch().rh.jh/jh4h[h6}r(h:]h;]h9]h8]h<]uh>Kh?hh(]rhSXIf your channel works with 0 to 1 API call, consider overriding this method. If your channel is susceptible of using several different API calls, consider overriding fetch().rr}r(h-jh.jubaubeubeubh)r}r(h-Uh.jWh/X/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/autocomplete_light/channel/remote.py:docstring of autocomplete_light.channel.remote.RemoteChannelBase.get_remote_resultsrh4hh6}r(h8]h9]h:]h;]h<]Uentries]r(hXQget_remote_results() (autocomplete_light.channel.remote.RemoteChannelBase method)hUtrauh>Nh?hh(]ubj)r}r(h-Uh.jWh/jh4j h6}r(j j Xpyh8]h9]h:]h;]h<]j Xmethodrjjuh>Nh?hh(]r(j)r}r(h-X)RemoteChannelBase.get_remote_results(max)h.jh/jh4jh6}r(h8]rhajh0X!autocomplete_light.channel.remoterr}rbh9]h:]h;]h<]rhajX$RemoteChannelBase.get_remote_resultsrj jj!uh>Nh?hh(]r(j5)r}r(h-Xget_remote_resultsh.jh/jh4j8h6}r(h:]h;]h9]h8]h<]uh>Nh?hh(]rhSXget_remote_resultsrr}r(h-Uh.jubaubj\)r}r(h-Uh.jh/jh4j_h6}r(h:]h;]h9]h8]h<]uh>Nh?hh(]r jb)r }r (h-Xmaxh6}r (h:]h;]h9]h8]h<]uh.jh(]r hSXmaxrr}r(h-Uh.j ubah4jjubaubj>)r}r(h-Uh.jh/Nh4jAh6}r(UexprjCh8]h9]h:]h;]h<]uh>Nh?hh(]rh)r}r(h-Uh6}r(UreftypejHUrefdochU refdomainjIh8]h9]U refexplicith:]h;]h<]U reftargetX*_modules/autocomplete_light/channel/remoteUrefidjuh.jh(]rjK)r}r(h-Uh6}r(h:]h;]rjPah9]h8]h<]uh.jh(]rhSX[source]rr}r (h-Uh.jubah4jUubah4hubaubeubjV)r!}r"(h-Uh.jh/jh4jYh6}r#(h:]h;]h9]h8]h<]uh>Nh?hh(]r$(hW)r%}r&(h-X1Parses JSON from the API, return model instances.r'h.j!h/jh4h[h6}r((h:]h;]h9]h8]h<]uh>Kh?hh(]r)hSX1Parses JSON from the API, return model instances.r*r+}r,(h-j'h.j%ubaubhW)r-}r.(h-XThe JSON should contain a list of dicts. Each dict should contain the attributes of an object. Relation attributes should be represented by their url in the API, which is set to model._source_url.r/h.j!h/jh4h[h6}r0(h:]h;]h9]h8]h<]uh>Kh?hh(]r1hSXThe JSON should contain a list of dicts. Each dict should contain the attributes of an object. Relation attributes should be represented by their url in the API, which is set to model._source_url.r2r3}r4(h-j/h.j-ubaubeubeubh)r5}r6(h-Uh.jWh/X/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/autocomplete_light/channel/remote.py:docstring of autocomplete_light.channel.remote.RemoteChannelBase.get_resultsr7h4hh6}r8(h8]h9]h:]h;]h<]Uentries]r9(hXJget_results() (autocomplete_light.channel.remote.RemoteChannelBase method)hUtr:auh>Nh?hh(]ubj)r;}r<(h-Uh.jWh/j7h4j h6}r=(j j Xpyh8]h9]h:]h;]h<]j Xmethodr>jj>uh>Nh?hh(]r?(j)r@}rA(h-X*RemoteChannelBase.get_results(values=None)h.j;h/jh4jh6}rB(h8]rChajh0X!autocomplete_light.channel.remoterDrE}rFbh9]h:]h;]h<]rGhajXRemoteChannelBase.get_resultsrHj jj!uh>Nh?hh(]rI(j5)rJ}rK(h-X get_resultsh.j@h/jh4j8h6}rL(h:]h;]h9]h8]h<]uh>Nh?hh(]rMhSX get_resultsrNrO}rP(h-Uh.jJubaubj\)rQ}rR(h-Uh.j@h/jh4j_h6}rS(h:]h;]h9]h8]h<]uh>Nh?hh(]rTjb)rU}rV(h-X values=Noneh6}rW(h:]h;]h9]h8]h<]uh.jQh(]rXhSX values=NonerYrZ}r[(h-Uh.jUubah4jjubaubj>)r\}r](h-Uh.j@h/Nh4jAh6}r^(UexprjCh8]h9]h:]h;]h<]uh>Nh?hh(]r_h)r`}ra(h-Uh6}rb(UreftypejHUrefdochU refdomainjIh8]h9]U refexplicith:]h;]h<]U reftargetX*_modules/autocomplete_light/channel/remoteUrefidjHuh.j\h(]rcjK)rd}re(h-Uh6}rf(h:]h;]rgjPah9]h8]h<]uh.j`h(]rhhSX[source]rirj}rk(h-Uh.jdubah4jUubah4hubaubeubjV)rl}rm(h-Uh.j;h/jh4jYh6}rn(h:]h;]h9]h8]h<]uh>Nh?hh(]ro(hW)rp}rq(h-XbReturns a list of results from both the local database and the API if in the context of a request.rrh.jlh/j7h4h[h6}rs(h:]h;]h9]h8]h<]uh>Kh?hh(]rthSXbReturns a list of results from both the local database and the API if in the context of a request.rurv}rw(h-jrh.jpubaubhW)rx}ry(h-XaUsing self.limit_results and the number of local results, adds results from get_remote_results().rzh.jlh/j7h4h[h6}r{(h:]h;]h9]h8]h<]uh>Kh?hh(]r|hSXaUsing self.limit_results and the number of local results, adds results from get_remote_results().r}r~}r(h-jzh.jxubaubeubeubh)r}r(h-Uh.jWh/X/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/autocomplete_light/channel/remote.py:docstring of autocomplete_light.channel.remote.RemoteChannelBase.get_source_urlrh4hh6}r(h8]h9]h:]h;]h<]Uentries]r(hXMget_source_url() (autocomplete_light.channel.remote.RemoteChannelBase method)hUtrauh>Nh?hh(]ubj)r}r(h-Uh.jWh/jh4j h6}r(j j Xpyh8]h9]h:]h;]h<]j Xmethodrjjuh>Nh?hh(]r(j)r}r(h-X'RemoteChannelBase.get_source_url(limit)h.jh/jh4jh6}r(h8]rhajh0X!autocomplete_light.channel.remoterr}rbh9]h:]h;]h<]rhajX RemoteChannelBase.get_source_urlrj jj!uh>Nh?hh(]r(j5)r}r(h-Xget_source_urlh.jh/jh4j8h6}r(h:]h;]h9]h8]h<]uh>Nh?hh(]rhSXget_source_urlrr}r(h-Uh.jubaubj\)r}r(h-Uh.jh/jh4j_h6}r(h:]h;]h9]h8]h<]uh>Nh?hh(]rjb)r}r(h-Xlimith6}r(h:]h;]h9]h8]h<]uh.jh(]rhSXlimitrr}r(h-Uh.jubah4jjubaubj>)r}r(h-Uh.jh/Nh4jAh6}r(UexprjCh8]h9]h:]h;]h<]uh>Nh?hh(]rh)r}r(h-Uh6}r(UreftypejHUrefdochU refdomainjIh8]h9]U refexplicith:]h;]h<]U reftargetX*_modules/autocomplete_light/channel/remoteUrefidjuh.jh(]rjK)r}r(h-Uh6}r(h:]h;]rjPah9]h8]h<]uh.jh(]rhSX[source]rr}r(h-Uh.jubah4jUubah4hubaubeubjV)r}r(h-Uh.jh/jh4jYh6}r(h:]h;]h9]h8]h<]uh>Nh?hh(]r(hW)r}r(h-X7Return an API url for the current autocomplete request.rh.jh/jh4h[h6}r(h:]h;]h9]h8]h<]uh>Kh?hh(]rhSX7Return an API url for the current autocomplete request.rr}r(h-jh.jubaubhW)r}r(h-XXBy default, return self.source_url with the data dict returned by get_source_url_data().rh.jh/jh4h[h6}r(h:]h;]h9]h8]h<]uh>Kh?hh(]rhSXXBy default, return self.source_url with the data dict returned by get_source_url_data().rr}r(h-jh.jubaubeubeubh)r}r(h-Uh.jWh/X/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/autocomplete_light/channel/remote.py:docstring of autocomplete_light.channel.remote.RemoteChannelBase.get_source_url_datarh4hh6}r(h8]h9]h:]h;]h<]Uentries]r(hXRget_source_url_data() (autocomplete_light.channel.remote.RemoteChannelBase method)hUtrauh>Nh?hh(]ubj)r}r(h-Uh.jWh/jh4j h6}r(j j Xpyh8]h9]h:]h;]h<]j Xmethodrjjuh>Nh?hh(]r(j)r}r(h-X,RemoteChannelBase.get_source_url_data(limit)h.jh/jh4jh6}r(h8]rhajh0X!autocomplete_light.channel.remoterr}rbh9]h:]h;]h<]rhajX%RemoteChannelBase.get_source_url_datarj jj!uh>Nh?hh(]r(j5)r}r(h-Xget_source_url_datah.jh/jh4j8h6}r(h:]h;]h9]h8]h<]uh>Nh?hh(]rhSXget_source_url_datarr}r(h-Uh.jubaubj\)r}r(h-Uh.jh/jh4j_h6}r(h:]h;]h9]h8]h<]uh>Nh?hh(]rjb)r}r(h-Xlimith6}r(h:]h;]h9]h8]h<]uh.jh(]rhSXlimitrr}r(h-Uh.jubah4jjubaubj>)r}r(h-Uh.jh/Nh4jAh6}r(UexprjCh8]h9]h:]h;]h<]uh>Nh?hh(]rh)r}r(h-Uh6}r(UreftypejHUrefdochU refdomainjIh8]h9]U refexplicith:]h;]h<]U reftargetX*_modules/autocomplete_light/channel/remoteUrefidjuh.jh(]rjK)r}r(h-Uh6}r(h:]h;]rjPah9]h8]h<]uh.jh(]rhSX[source]rr}r(h-Uh.jubah4jUubah4hubaubeubjV)r}r(h-Uh.jh/jh4jYh6}r(h:]h;]h9]h8]h<]uh>Nh?hh(]r(hW)r}r(h-XAGiven a limit of items, return a dict of data to send to the API.rh.jh/jh4h[h6}r (h:]h;]h9]h8]h<]uh>Kh?hh(]r hSXAGiven a limit of items, return a dict of data to send to the API.r r }r (h-jh.jubaubhW)r}r(h-X]By default, it passes current request GET arguments, along with format: 'json' and the limit.rh.jh/jh4h[h6}r(h:]h;]h9]h8]h<]uh>Kh?hh(]rhSX]By default, it passes current request GET arguments, along with format: 'json' and the limit.rr}r(h-jh.jubaubeubeubh)r}r(h-Uh.jWh/X/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/autocomplete_light/channel/remote.py:docstring of autocomplete_light.channel.remote.RemoteChannelBase.model_for_source_urlrh4hh6}r(h8]h9]h:]h;]h<]Uentries]r(hXSmodel_for_source_url() (autocomplete_light.channel.remote.RemoteChannelBase method)h Utrauh>Nh?hh(]ubj)r}r(h-Uh.jWh/jh4j h6}r(j j Xpyh8]h9]h:]h;]h<]j Xmethodrjjuh>Nh?hh(]r (j)r!}r"(h-X+RemoteChannelBase.model_for_source_url(url)h.jh/jh4jh6}r#(h8]r$h ajh0X!autocomplete_light.channel.remoter%r&}r'bh9]h:]h;]h<]r(h ajX&RemoteChannelBase.model_for_source_urlr)j jj!uh>Nh?hh(]r*(j5)r+}r,(h-Xmodel_for_source_urlh.j!h/jh4j8h6}r-(h:]h;]h9]h8]h<]uh>Nh?hh(]r.hSXmodel_for_source_urlr/r0}r1(h-Uh.j+ubaubj\)r2}r3(h-Uh.j!h/jh4j_h6}r4(h:]h;]h9]h8]h<]uh>Nh?hh(]r5jb)r6}r7(h-Xurlh6}r8(h:]h;]h9]h8]h<]uh.j2h(]r9hSXurlr:r;}r<(h-Uh.j6ubah4jjubaubj>)r=}r>(h-Uh.j!h/Nh4jAh6}r?(UexprjCh8]h9]h:]h;]h<]uh>Nh?hh(]r@h)rA}rB(h-Uh6}rC(UreftypejHUrefdochU refdomainjIh8]h9]U refexplicith:]h;]h<]U reftargetX*_modules/autocomplete_light/channel/remoteUrefidj)uh.j=h(]rDjK)rE}rF(h-Uh6}rG(h:]h;]rHjPah9]h8]h<]uh.jAh(]rIhSX[source]rJrK}rL(h-Uh.jEubah4jUubah4hubaubeubjV)rM}rN(h-Uh.jh/jh4jYh6}rO(h:]h;]h9]h8]h<]uh>Nh?hh(]rP(hW)rQ}rR(h-XrTake an URL from the API this remote channel is supposed to work with, return the model class to use for that url.rSh.jMh/jh4h[h6}rT(h:]h;]h9]h8]h<]uh>Kh?hh(]rUhSXrTake an URL from the API this remote channel is supposed to work with, return the model class to use for that url.rVrW}rX(h-jSh.jQubaubhW)rY}rZ(h-XlIt is only needed for the default implementation of fetch(), because it has to follow relations recursively.r[h.jMh/jh4h[h6}r\(h:]h;]h9]h8]h<]uh>Kh?hh(]r]hSXlIt is only needed for the default implementation of fetch(), because it has to follow relations recursively.r^r_}r`(h-j[h.jYubaubeubeubh)ra}rb(h-Uh.jWh/X/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/autocomplete_light/channel/remote.py:docstring of autocomplete_light.channel.remote.RemoteChannelBase.postrch4hh6}rd(h8]h9]h:]h;]h<]Uentries]re(hXCpost() (autocomplete_light.channel.remote.RemoteChannelBase method)hUtrfauh>Nh?hh(]ubj)rg}rh(h-Uh.jWh/jch4j h6}ri(j j Xpyh8]h9]h:]h;]h<]j Xmethodrjjjjuh>Nh?hh(]rk(j)rl}rm(h-X0RemoteChannelBase.post(request, *args, **kwargs)h.jgh/jh4jh6}rn(h8]rohajh0X!autocomplete_light.channel.remoterprq}rrbh9]h:]h;]h<]rshajXRemoteChannelBase.postrtj jj!uh>Nh?hh(]ru(j5)rv}rw(h-Xposth.jlh/jh4j8h6}rx(h:]h;]h9]h8]h<]uh>Nh?hh(]ryhSXpostrzr{}r|(h-Uh.jvubaubj\)r}}r~(h-Uh.jlh/jh4j_h6}r(h:]h;]h9]h8]h<]uh>Nh?hh(]r(jb)r}r(h-Xrequesth6}r(h:]h;]h9]h8]h<]uh.j}h(]rhSXrequestrr}r(h-Uh.jubah4jjubjb)r}r(h-X*argsh6}r(h:]h;]h9]h8]h<]uh.j}h(]rhSX*argsrr}r(h-Uh.jubah4jjubjb)r}r(h-X**kwargsh6}r(h:]h;]h9]h8]h<]uh.j}h(]rhSX**kwargsrr}r(h-Uh.jubah4jjubeubj>)r}r(h-Uh.jlh/Nh4jAh6}r(UexprjCh8]h9]h:]h;]h<]uh>Nh?hh(]rh)r}r(h-Uh6}r(UreftypejHUrefdochU refdomainjIh8]h9]U refexplicith:]h;]h<]U reftargetX*_modules/autocomplete_light/channel/remoteUrefidjtuh.jh(]rjK)r}r(h-Uh6}r(h:]h;]rjPah9]h8]h<]uh.jh(]rhSX[source]rr}r(h-Uh.jubah4jUubah4hubaubeubjV)r}r(h-Uh.jgh/jh4jYh6}r(h:]h;]h9]h8]h<]uh>Nh?hh(]r(hW)r}r(h-X[Take POST variable 'result', install it in the local database, return the newly created id.rh.jh/jch4h[h6}r(h:]h;]h9]h8]h<]uh>Kh?hh(]rhSX[Take POST variable 'result', install it in the local database, return the newly created id.rr}r(h-jh.jubaubhW)r}r(h-X.The HTTP response has status code 201 Created.rh.jh/jch4h[h6}r(h:]h;]h9]h8]h<]uh>Kh?hh(]rhSX.The HTTP response has status code 201 Created.rr}r(h-jh.jubaubeubeubh)r}r(h-Uh.jWh/X/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/autocomplete_light/channel/remote.py:docstring of autocomplete_light.channel.remote.RemoteChannelBase.result_as_dictrh4hh6}r(h8]h9]h:]h;]h<]Uentries]r(hXMresult_as_dict() (autocomplete_light.channel.remote.RemoteChannelBase method)hUtrauh>Nh?hh(]ubj)r}r(h-Uh.jWh/jh4j h6}r(j j Xpyh8]h9]h:]h;]h<]j Xmethodrjjuh>Nh?hh(]r(j)r}r(h-X(RemoteChannelBase.result_as_dict(result)h.jh/jh4jh6}r(h8]rhajh0X!autocomplete_light.channel.remoterr}rbh9]h:]h;]h<]rhajX RemoteChannelBase.result_as_dictrj jj!uh>Nh?hh(]r(j5)r}r(h-Xresult_as_dicth.jh/jh4j8h6}r(h:]h;]h9]h8]h<]uh>Nh?hh(]rhSXresult_as_dictrr}r(h-Uh.jubaubj\)r}r(h-Uh.jh/jh4j_h6}r(h:]h;]h9]h8]h<]uh>Nh?hh(]rjb)r}r(h-Xresulth6}r(h:]h;]h9]h8]h<]uh.jh(]rhSXresultrr}r(h-Uh.jubah4jjubaubj>)r}r(h-Uh.jh/Nh4jAh6}r(UexprjCh8]h9]h:]h;]h<]uh>Nh?hh(]rh)r}r(h-Uh6}r(UreftypejHUrefdochU refdomainjIh8]h9]U refexplicith:]h;]h<]U reftargetX*_modules/autocomplete_light/channel/remoteUrefidjuh.jh(]rjK)r}r(h-Uh6}r(h:]h;]rjPah9]h8]h<]uh.jh(]rhSX[source]rr}r(h-Uh.jubah4jUubah4hubaubeubjV)r}r(h-Uh.jh/jh4jYh6}r(h:]h;]h9]h8]h<]uh>Nh?hh(]rhW)r}r(h-X$Return the result pk or _source_url.rh.jh/jh4h[h6}r(h:]h;]h9]h8]h<]uh>Kh?hh(]rhSX$Return the result pk or _source_url.rr}r(h-jh.jubaubaubeubh)r}r(h-Uh.jWh/X/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/autocomplete_light/channel/remote.py:docstring of autocomplete_light.channel.remote.RemoteChannelBase.result_as_valuerh4hh6}r(h8]h9]h:]h;]h<]Uentries]r(hXNresult_as_value() (autocomplete_light.channel.remote.RemoteChannelBase method)hUtrauh>Nh?hh(]ubj)r}r(h-Uh.jWh/jh4j h6}r(j j Xpyh8]h9]h:]h;]h<]j Xmethodrjjuh>Nh?hh(]r(j)r}r (h-X)RemoteChannelBase.result_as_value(result)r h.jh/jh4jh6}r (h8]r hajh0X!autocomplete_light.channel.remoter r}rbh9]h:]h;]h<]rhajX!RemoteChannelBase.result_as_valuerj jj!uh>Nh?hh(]r(j5)r}r(h-Xresult_as_valueh.jh/jh4j8h6}r(h:]h;]h9]h8]h<]uh>Nh?hh(]rhSXresult_as_valuerr}r(h-Uh.jubaubj\)r}r(h-Uh.jh/jh4j_h6}r(h:]h;]h9]h8]h<]uh>Nh?hh(]rjb)r}r(h-Xresulth6}r (h:]h;]h9]h8]h<]uh.jh(]r!hSXresultr"r#}r$(h-Uh.jubah4jjubaubj>)r%}r&(h-Uh.jh/Nh4jAh6}r'(UexprjCh8]h9]h:]h;]h<]uh>Nh?hh(]r(h)r)}r*(h-Uh6}r+(UreftypejHUrefdochU refdomainjIh8]h9]U refexplicith:]h;]h<]U reftargetX*_modules/autocomplete_light/channel/remoteUrefidjuh.j%h(]r,jK)r-}r.(h-Uh6}r/(h:]h;]r0jPah9]h8]h<]uh.j)h(]r1hSX[source]r2r3}r4(h-Uh.j-ubah4jUubah4hubaubeubjV)r5}r6(h-Uh.jh/jh4jYh6}r7(h:]h;]h9]h8]h<]uh>Nh?hh(]r8hW)r9}r:(h-X#Return the result pk or source url.r;h.j5h/jh4h[h6}r<(h:]h;]h9]h8]h<]uh>Kh?hh(]r=hSX#Return the result pk or source url.r>r?}r@(h-j;h.j9ubaubaubeubeubeubh*)rA}rB(h-X.. _javascript-fun:h.hh/h2h4h5h6}rC(h8]h9]h:]h;]h<]h=h%uh>K&h?hh(]ubeubh@)rD}rE(h-Uh.hAh/h2hC}rFhjAsh4hEh6}rG(h:]h;]h9]h8]rH(h%h"eh<]rI(h heuh>K)h?hhI}rJh%jAsh(]rK(hL)rL}rM(h-XJavascript funrNh.jDh/h2h4hPh6}rO(h:]h;]h9]h8]h<]uh>K)h?hh(]rPhSXJavascript funrQrR}rS(h-jNh.jLubaubhW)rT}rU(h-XChannels with `bootstrap='remote'` get a deck using `RemoteChannelDeck's getValue()` rather than the default `getValue()` function.h.jDh/h2h4h[h6}rV(h:]h;]h9]h8]h<]uh>K+h?hh(]rW(hSXChannels with rXrY}rZ(h-XChannels with h.jTubh)r[}r\(h-X`bootstrap='remote'`h6}r](h:]h;]h9]h8]h<]uh.jTh(]r^hSXbootstrap='remote'r_r`}ra(h-Uh.j[ubah4hubhSX get a deck using rbrc}rd(h-X get a deck using h.jTubh)re}rf(h-X `RemoteChannelDeck's getValue()`h6}rg(h:]h;]h9]h8]h<]uh.jTh(]rhhSXRemoteChannelDeck's getValue()rirj}rk(h-Uh.jeubah4hubhSX rather than the default rlrm}rn(h-X rather than the default h.jTubh)ro}rp(h-X `getValue()`h6}rq(h:]h;]h9]h8]h<]uh.jTh(]rrhSX getValue()rsrt}ru(h-Uh.joubah4hubhSX function.rvrw}rx(h-X function.h.jTubeubh)ry}rz(h-Xvar RemoteChannelDeck = { // The default deck getValue() implementation just returns the PK from the // result HTML. RemoteChannelDeck's implementation checks for a textarea // that would contain a JSON dict in the result's HTML. If the dict has a // 'value' key, then return this value. Otherwise, make a blocking ajax // request: POST the json dict to the channel url. It expects that the // response will contain the value. getValue: function(result) { data = $.parseJSON(result.find('textarea').html()); if (data.value) return data.value; var value = false; $.ajax(this.payload.channel.url, { async: false, type: 'post', data: { 'result': result.find('textarea').html(), }, success: function(text, jqXHR, textStatus) { value = text; } }); return value; } } $(document).ready(function() { // Instanciate decks with RemoteChannelDeck as override for all widgets with // channel 'remote'. $('.autocomplete_light_widget[data-bootstrap=remote]').each(function() { $(this).yourlabs_deck(RemoteChannelDeck); }); }); h.jDh/h2h4hh6}r{(hh0X javascriptr|r}}r~bh:]hhh8]h9]UsourceX/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/docs/source/../../autocomplete_light/static/autocomplete_light/remote.jsh;]h<]uh>K.h?hh(]rhSXvar RemoteChannelDeck = { // The default deck getValue() implementation just returns the PK from the // result HTML. RemoteChannelDeck's implementation checks for a textarea // that would contain a JSON dict in the result's HTML. If the dict has a // 'value' key, then return this value. Otherwise, make a blocking ajax // request: POST the json dict to the channel url. It expects that the // response will contain the value. getValue: function(result) { data = $.parseJSON(result.find('textarea').html()); if (data.value) return data.value; var value = false; $.ajax(this.payload.channel.url, { async: false, type: 'post', data: { 'result': result.find('textarea').html(), }, success: function(text, jqXHR, textStatus) { value = text; } }); return value; } } $(document).ready(function() { // Instanciate decks with RemoteChannelDeck as override for all widgets with // channel 'remote'. $('.autocomplete_light_widget[data-bootstrap=remote]').each(function() { $(this).yourlabs_deck(RemoteChannelDeck); }); }); rr}r(h-Uh.jyubaubeubeubeh-UU transformerrNU footnote_refsr}rUrefnamesr}rUsymbol_footnotesr]rUautofootnote_refsr]rUsymbol_footnote_refsr]rU citationsr]rh?hU current_linerNUtransform_messagesr]r(cdocutils.nodes system_message r)r}r(h-Uh6}r(h:]UlevelKh8]h9]Usourceh2h;]h<]UlineKUtypeUINFOruh(]rhW)r}r(h-Uh6}r(h:]h;]h9]h8]h<]uh.jh(]rhSX,Hyperlink target "remote" is not referenced.rr}r(h-Uh.jubah4h[ubah4Usystem_messagerubj)r}r(h-Uh6}r(h:]UlevelKh8]h9]Usourceh2h;]h<]UlineKUtypejuh(]rhW)r}r(h-Uh6}r(h:]h;]h9]h8]h<]uh.jh(]rhSX4Hyperlink target "remote-example" is not referenced.rr}r(h-Uh.jubah4h[ubah4jubj)r}r(h-Uh6}r(h:]UlevelKh8]h9]Usourceh2h;]h<]UlineK&Utypejuh(]rhW)r}r(h-Uh6}r(h:]h;]h9]h8]h<]uh.jh(]rhSX4Hyperlink target "javascript-fun" is not referenced.rr}r(h-Uh.jubah4h[ubah4jubeUreporterrNUid_startrKU autofootnotesr]rU citation_refsr}rUindirect_targetsr]rUsettingsr(cdocutils.frontend Values ror}r(Ufootnote_backlinksrKUrecord_dependenciesrNU rfc_base_urlrUhttp://tools.ietf.org/html/rU tracebackrUpep_referencesrNUstrip_commentsrNU toc_backlinksrUentryrU language_coderUenrU datestamprNU report_levelrKU _destinationrNU halt_levelrKU strip_classesrNhPNUerror_encoding_error_handlerrUbackslashreplacerUdebugrNUembed_stylesheetrUoutput_encoding_error_handlerrUstrictrU sectnum_xformrKUdump_transformsrNU docinfo_xformrKUwarning_streamrNUpep_file_url_templaterUpep-%04drUexit_status_levelrKUconfigrNUstrict_visitorrNUcloak_email_addressesrUtrim_footnote_reference_spacerUenvrNUdump_pseudo_xmlrNUexpose_internalsrNUsectsubtitle_xformrU source_linkrNUrfc_referencesrNUoutput_encodingrUutf-8rU source_urlrNUinput_encodingrU utf-8-sigrU_disable_configrNU id_prefixrUU tab_widthrKUerror_encodingrUasciirU_sourcerU/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/docs/source/remote.rstrUgettext_compactrU generatorrNUdump_internalsrNU pep_base_urlrUhttp://www.python.org/dev/peps/rUsyntax_highlightrUshortrUinput_encoding_error_handlerrjUauto_id_prefixrUidrUdoctitle_xformrUstrip_elements_with_classesrNU _config_filesr]Ufile_insertion_enabledrKU raw_enabledrKU dump_settingsrNubUsymbol_footnote_startrKUidsr}r(h#hAhjh!hAhh*)r }r (h-Uh.hh/hh4h5h6}r (h:]h8]r hah9]Uismodh;]h<]uh>Kh?hh(]ubhjh j!h$hh jhjh"jDhjh%jDh&hhjhjlhj@hjKh'hhjuUsubstitution_namesr }rh4h?h6}r(h:]h8]h9]Usourceh2h;]h<]uU footnotesr]rUrefidsr}r(h$]rhah%]rjAah!]rh+auub.PK6@QAPP?django-autocomplete-light-0.8/.doctrees/_admin_template.doctreecdocutils.nodes document q)q}q(U nametypesq}qUsubstitution_defsq}qUparse_messagesq]q Ucurrent_sourceq NU decorationq NUautofootnote_startq KUnameidsq }qUchildrenq]q(cdocutils.nodes paragraph q)q}q(U rawsourceqXFor AutocompleteWidget to be enabled in the admin, you should create your own ``admin/base_site.html`` template as demonstrated in ``test_project/templates/admin/base_site.html``:UparentqhUsourceqcdocutils.nodes reprunicode qX/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/docs/source/_admin_template.rstqq}qbUtagnameqU paragraphqU attributesq}q(Udupnamesq]Uclassesq ]Ubackrefsq!]Uidsq"]Unamesq#]uUlineq$KUdocumentq%hh]q&(cdocutils.nodes Text q'XNFor AutocompleteWidget to be enabled in the admin, you should create your own q(q)}q*(hXNFor AutocompleteWidget to be enabled in the admin, you should create your own hhubcdocutils.nodes literal q+)q,}q-(hX``admin/base_site.html``h}q.(h]h ]h!]h"]h#]uhhh]q/h'Xadmin/base_site.htmlq0q1}q2(hUhh,ubahUliteralq3ubh'X template as demonstrated in q4q5}q6(hX template as demonstrated in hhubh+)q7}q8(hX/``test_project/templates/admin/base_site.html``h}q9(h]h ]h!]h"]h#]uhhh]q:h'X+test_project/templates/admin/base_site.htmlq;q<}q=(hUhh7ubahh3ubh'X:q>}q?(hX:hhubeubcdocutils.nodes literal_block q@)qA}qB(hX{% extends "admin/base.html" %} {% load i18n %} {% block footer %} {{ block.super }} {% include 'autocomplete_light/static.html' %} {% comment %} Load additionnal script or style dependencies here. For instance, the double country/city autocomplete widget requires the countrycity deck bootstrap so we'll load it. But you don't need this one if you don't use the countrycity widget of the cities_light app. {% endcomment %} {% endblock %} hhhhhU literal_blockqCh}qD(UlanguageqEhXhtmlqFqG}qHbh]U xml:spaceqIUpreserveqJh"]h!]UsourceX/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/docs/source/../../test_project/templates/admin/base_site.htmlh ]h#]uh$Kh%hh]qKh'X{% extends "admin/base.html" %} {% load i18n %} {% block footer %} {{ block.super }} {% include 'autocomplete_light/static.html' %} {% comment %} Load additionnal script or style dependencies here. For instance, the double country/city autocomplete widget requires the countrycity deck bootstrap so we'll load it. But you don't need this one if you don't use the countrycity widget of the cities_light app. {% endcomment %} {% endblock %} qLqM}qN(hUhhAubaubehUU transformerqONU footnote_refsqP}qQUrefnamesqR}qSUsymbol_footnotesqT]qUUautofootnote_refsqV]qWUsymbol_footnote_refsqX]qYU citationsqZ]q[h%hU current_lineq\NUtransform_messagesq]]q^Ureporterq_NUid_startq`KU autofootnotesqa]qbU citation_refsqc}qdUindirect_targetsqe]qfUsettingsqg(cdocutils.frontend Values qhoqi}qj(Ufootnote_backlinksqkKUrecord_dependenciesqlNU rfc_base_urlqmUhttp://tools.ietf.org/html/qnU tracebackqoUpep_referencesqpNUstrip_commentsqqNU toc_backlinksqrUentryqsU language_codeqtUenquU datestampqvNU report_levelqwKU _destinationqxNU halt_levelqyKU strip_classesqzNUtitleq{NUerror_encoding_error_handlerq|Ubackslashreplaceq}Udebugq~NUembed_stylesheetqUoutput_encoding_error_handlerqUstrictqU sectnum_xformqKUdump_transformsqNU docinfo_xformqKUwarning_streamqNUpep_file_url_templateqUpep-%04dqUexit_status_levelqKUconfigqNUstrict_visitorqNUcloak_email_addressesqUtrim_footnote_reference_spaceqUenvqNUdump_pseudo_xmlqNUexpose_internalsqNUsectsubtitle_xformqU source_linkqNUrfc_referencesqNUoutput_encodingqUutf-8qU source_urlqNUinput_encodingqU utf-8-sigqU_disable_configqNU id_prefixqUU tab_widthqKUerror_encodingqUasciiqU_sourceqU/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/docs/source/_admin_template.rstqUgettext_compactqU generatorqNUdump_internalsqNU pep_base_urlqUhttp://www.python.org/dev/peps/qUsyntax_highlightqUshortqUinput_encoding_error_handlerqhUauto_id_prefixqUidqUdoctitle_xformqUstrip_elements_with_classesqNU _config_filesq]Ufile_insertion_enabledqKU raw_enabledqKU dump_settingsqNubUsymbol_footnote_startqKUidsq}qUsubstitution_namesq}qhh%h}q(h]h"]h!]Usourcehh ]h#]uU footnotesq]qUrefidsq}qub.PK6@j5ڔ7django-autocomplete-light-0.8/.doctrees/generic.doctreecdocutils.nodes document q)q}q(U nametypesq}q(X5autocomplete_light.channel.generic.GenericChannelBaseqXdjango-generic-m2mqX?autocomplete_light.generic.GenericForeignKeyField.prepare_valueqXapiq NXgenericmanytomanyq NX generic-m2mq XCautocomplete_light.channel.generic.GenericChannelBase.order_resultsq X7autocomplete_light.contrib.generic_m2m.GenericModelFormq X?autocomplete_light.channel.generic.GenericChannelBase.are_validqX8autocomplete_light.contrib.generic_m2m.GenericManyToManyqXgenericchannelbaseqNXEautocomplete_light.channel.generic.GenericChannelBase.result_as_valueqX generic-fkqXCautocomplete_light.channel.generic.GenericChannelBase.values_filterqXAautocomplete_light.channel.generic.GenericChannelBase.get_resultsqX0autocomplete_light.generic.GenericModelForm.saveqX;autocomplete_light.generic.GenericForeignKeyField.to_pythonqX1autocomplete_light.generic.GenericForeignKeyFieldqXgenericforeignkeyfieldqNXJautocomplete_light.contrib.generic_m2m.GenericModelForm.generic_m2m_fieldsqX@autocomplete_light.contrib.generic_m2m.GenericModelForm.save_m2mqXgenericforeignkey supportqNX<autocomplete_light.contrib.generic_m2m.GenericModelForm.saveqX+autocomplete_light.generic.GenericModelFormqXexampleqNuUsubstitution_defsq}q Uparse_messagesq!]q"(cdocutils.nodes system_message q#)q$}q%(U rawsourceq&UUparentq'cdocutils.nodes section q()q)}q*(h&UU referencedq+Kh'h()q,}q-(h&Uh'h()q.}q/(h&Uh'hUsourceq0cdocutils.nodes reprunicode q1X/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/docs/source/generic.rstq2q3}q4bUtagnameq5Usectionq6U attributesq7}q8(Udupnamesq9]Uclassesq:]Ubackrefsq;]Uidsq<]q=Ugenericforeignkey-supportq>aUnamesq?]q@hauUlineqAKUdocumentqBhUchildrenqC]qD(cdocutils.nodes title qE)qF}qG(h&XGenericForeignKey supportqHh'h.h0h3h5UtitleqIh7}qJ(h9]h:]h;]h<]h?]uhAKhBhhC]qKcdocutils.nodes Text qLXGenericForeignKey supportqMqN}qO(h&hHh'hFubaubcdocutils.nodes paragraph qP)qQ}qR(h&X-Generic foreign keys are supported since 0.4.qSh'h.h0h3h5U paragraphqTh7}qU(h9]h:]h;]h<]h?]uhAKhBhhC]qVhLX-Generic foreign keys are supported since 0.4.qWqX}qY(h&hSh'hQubaubh()qZ}q[(h&Uh'h.h0h3h5h6h7}q\(h9]h:]h;]h<]q]Ugenericchannelbaseq^ah?]q_hauhAKhBhhC]q`(hE)qa}qb(h&XGenericChannelBaseqch'hZh0h3h5hIh7}qd(h9]h:]h;]h<]h?]uhAKhBhhC]qehLXGenericChannelBaseqfqg}qh(h&hch'haubaubh()qi}qj(h&Uh+Kh'hZh0h3h5h6h7}qk(h9]qlXexampleqmah:]h;]h<]qnUexampleqoah?]uhAK hBhhC]qp(hE)qq}qr(h&XExampleqsh'hih0h3h5hIh7}qt(h9]h:]h;]h<]h?]uhAK hBhhC]quhLXExampleqvqw}qx(h&hsh'hqubaubcdocutils.nodes literal_block qy)qz}q{(h&XRimport autocomplete_light from models import Contact, Address class MyGenericChannel(autocomplete_light.GenericChannelBase): def get_querysets(self): return { Contact: Contact.objects.all(), Address: Address.objects.all(), } def order_results(self, results): if results.model == Address: return results.order_by('street') elif results.model == Contact: return results.order_by('name') def query_filter(self, results): q = self.request.GET.get('q', None) if q: if results.model == Address: results = results.filter(street__icontains=q) elif results.model == Contact: results = results.filter(name__icontains=q) return results autocomplete_light.register(MyGenericChannel) h'hih0h3h5U literal_blockq|h7}q}(Ulanguageq~h1Xpythonqq}qbh9]U xml:spaceqUpreserveqh<]h;]UsourceX/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/docs/source/../../test_api_project/project_specific/generic_channel_example.pyh:]h?]uhAK hBhhC]qhLXRimport autocomplete_light from models import Contact, Address class MyGenericChannel(autocomplete_light.GenericChannelBase): def get_querysets(self): return { Contact: Contact.objects.all(), Address: Address.objects.all(), } def order_results(self, results): if results.model == Address: return results.order_by('street') elif results.model == Contact: return results.order_by('name') def query_filter(self, results): q = self.request.GET.get('q', None) if q: if results.model == Address: results = results.filter(street__icontains=q) elif results.model == Contact: results = results.filter(name__icontains=q) return results autocomplete_light.register(MyGenericChannel) qq}q(h&Uh'hzubaubeubh()q}q(h&Uh+Kh'hZh0h3h5h6h7}q(h9]qXapiqah:]h;]h<]q(X)module-autocomplete_light.channel.genericqUapiqeh?]uhAKhBhhC]q(hE)q}q(h&XAPIqh'hh0h3h5hIh7}q(h9]h:]h;]h<]h?]uhAKhBhhC]qhLXAPIqq}q(h&hh'hubaubcsphinx.addnodes index q)q}q(h&Uh'hh0U qh5Uindexqh7}q(h<]h;]h9]h:]h?]Uentries]q(UsingleqX+autocomplete_light.channel.generic (module)X)module-autocomplete_light.channel.genericUtqauhAKhBhhC]ubh)q}q(h&Uh'hh0Nh5hh7}q(h<]h;]h9]h:]h?]Uentries]q(hX@GenericChannelBase (class in autocomplete_light.channel.generic)hUtqauhANhBhhC]ubcsphinx.addnodes desc q)q}q(h&Uh'hh0Nh5Udescqh7}q(UnoindexqUdomainqXpyh<]h;]h9]h:]h?]UobjtypeqXclassqUdesctypeqhuhANhBhhC]q(csphinx.addnodes desc_signature q)q}q(h&XGenericChannelBase()h'hh0U qh5Udesc_signatureqh7}q(h<]qhaUmoduleqh1X"autocomplete_light.channel.genericqq}qbh;]h9]h:]h?]qhaUfullnameqXGenericChannelBaseqUclassqUUfirstquhANhBhhC]q(csphinx.addnodes desc_annotation q)q}q(h&Xclass h'hh0hh5Udesc_annotationqh7}q(h9]h:]h;]h<]h?]uhANhBhhC]qhLXclass qɅq}q(h&Uh'hubaubcsphinx.addnodes desc_addname q)q}q(h&X#autocomplete_light.channel.generic.h'hh0hh5U desc_addnameqh7}q(h9]h:]h;]h<]h?]uhANhBhhC]qhLX#autocomplete_light.channel.generic.q҅q}q(h&Uh'hubaubcsphinx.addnodes desc_name q)q}q(h&hh'hh0hh5U desc_nameqh7}q(h9]h:]h;]h<]h?]uhANhBhhC]qhLXGenericChannelBaseqۅq}q(h&Uh'hubaubcsphinx.addnodes only q)q}q(h&Uh'hh0Nh5Uonlyqh7}q(UexprUhtmlqh<]h;]h9]h:]h?]uhANhBhhC]qcsphinx.addnodes pending_xref q)q}q(h&Uh7}q(UreftypeUviewcodeqUrefdocUgenericqU refdomainUstdqh<]h;]U refexplicith9]h:]h?]U reftargetX+_modules/autocomplete_light/channel/genericUrefidhuh'hhC]qcdocutils.nodes inline q)q}q(h&Uh7}q(h9]h:]qU viewcode-linkqah;]h<]h?]uh'hhC]qhLX[source]qq}q(h&Uh'hubah5Uinlinequbah5U pending_xrefqubaubeubcsphinx.addnodes desc_content q)q}q(h&Uh'hh0hh5U desc_contentqh7}q(h9]h:]h;]h<]h?]uhANhBhhC]q(hP)q}r(h&XSWraps around multiple querysets, from multiple model classes, rather than just one.rh'hh0X/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/autocomplete_light/channel/generic.py:docstring of autocomplete_light.channel.generic.GenericChannelBaserh5hTh7}r(h9]h:]h;]h<]h?]uhAKhBhhC]rhLXSWraps around multiple querysets, from multiple model classes, rather than just one.rr}r(h&jh'hubaubhP)r}r (h&XThis is also interresting as it overrides **all** the default model logic from ChannelBase. Hell, you could even copy it and make your CSVChannelBase, a channel that uses a CSV file as backend. But only if you're really bored or for a milion dollars.h'hh0jh5hTh7}r (h9]h:]h;]h<]h?]uhAKhBhhC]r (hLX*This is also interresting as it overrides r r }r(h&X*This is also interresting as it overrides h'jubcdocutils.nodes strong r)r}r(h&X**all**h7}r(h9]h:]h;]h<]h?]uh'jhC]rhLXallrr}r(h&Uh'jubah5UstrongrubhLX the default model logic from ChannelBase. Hell, you could even copy it and make your CSVChannelBase, a channel that uses a CSV file as backend. But only if you're really bored or for a milion dollars.rr}r(h&X the default model logic from ChannelBase. Hell, you could even copy it and make your CSVChannelBase, a channel that uses a CSV file as backend. But only if you're really bored or for a milion dollars.h'jubeubhP)r}r(h&X;Set result_template and autocomplete_template if necessary.rh'hh0jh5hTh7}r(h9]h:]h;]h<]h?]uhAK hBhhC]rhLX;Set result_template and autocomplete_template if necessary.r r!}r"(h&jh'jubaubh)r#}r$(h&Uh'hh0X/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/autocomplete_light/channel/generic.py:docstring of autocomplete_light.channel.generic.GenericChannelBase.are_validr%h5hh7}r&(h<]h;]h9]h:]h?]Uentries]r'(hXJare_valid() (autocomplete_light.channel.generic.GenericChannelBase method)hUtr(auhANhBhhC]ubh)r)}r*(h&Uh'hh0j%h5hh7}r+(hhXpyh<]h;]h9]h:]h?]hXmethodr,hj,uhANhBhhC]r-(h)r.}r/(h&X$GenericChannelBase.are_valid(values)h'j)h0hh5hh7}r0(h<]r1hahh1X"autocomplete_light.channel.genericr2r3}r4bh;]h9]h:]h?]r5hahXGenericChannelBase.are_validr6hhhuhANhBhhC]r7(h)r8}r9(h&X are_validh'j.h0hh5hh7}r:(h9]h:]h;]h<]h?]uhANhBhhC]r;hLX are_validr<r=}r>(h&Uh'j8ubaubcsphinx.addnodes desc_parameterlist r?)r@}rA(h&Uh'j.h0hh5Udesc_parameterlistrBh7}rC(h9]h:]h;]h<]h?]uhANhBhhC]rDcsphinx.addnodes desc_parameter rE)rF}rG(h&Xvaluesh7}rH(h9]h:]h;]h<]h?]uh'j@hC]rIhLXvaluesrJrK}rL(h&Uh'jFubah5Udesc_parameterrMubaubh)rN}rO(h&Uh'j.h0Nh5hh7}rP(Uexprhh<]h;]h9]h:]h?]uhANhBhhC]rQh)rR}rS(h&Uh7}rT(UreftypehUrefdochU refdomainhh<]h;]U refexplicith9]h:]h?]U reftargetX+_modules/autocomplete_light/channel/genericUrefidj6uh'jNhC]rUh)rV}rW(h&Uh7}rX(h9]h:]rYhah;]h<]h?]uh'jRhC]rZhLX[source]r[r\}r](h&Uh'jVubah5hubah5hubaubeubh)r^}r_(h&Uh'j)h0hh5hh7}r`(h9]h:]h;]h<]h?]uhANhBhhC]rahP)rb}rc(h&X<Return True if it can find all the models refered by values.rdh'j^h0j%h5hTh7}re(h9]h:]h;]h<]h?]uhAKhBhhC]rfhLX<Return True if it can find all the models refered by values.rgrh}ri(h&jdh'jbubaubaubeubh)rj}rk(h&Uh'hh0X/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/autocomplete_light/channel/generic.py:docstring of autocomplete_light.channel.generic.GenericChannelBase.get_resultsrlh5hh7}rm(h<]h;]h9]h:]h?]Uentries]rn(hXLget_results() (autocomplete_light.channel.generic.GenericChannelBase method)hUtroauhANhBhhC]ubh)rp}rq(h&Uh'hh0jlh5hh7}rr(hhXpyh<]h;]h9]h:]h?]hXmethodrshjsuhANhBhhC]rt(h)ru}rv(h&X+GenericChannelBase.get_results(values=None)h'jph0hh5hh7}rw(h<]rxhahh1X"autocomplete_light.channel.genericryrz}r{bh;]h9]h:]h?]r|hahXGenericChannelBase.get_resultsr}hhhuhANhBhhC]r~(h)r}r(h&X get_resultsh'juh0hh5hh7}r(h9]h:]h;]h<]h?]uhANhBhhC]rhLX get_resultsrr}r(h&Uh'jubaubj?)r}r(h&Uh'juh0hh5jBh7}r(h9]h:]h;]h<]h?]uhANhBhhC]rjE)r}r(h&X values=Noneh7}r(h9]h:]h;]h<]h?]uh'jhC]rhLX values=Nonerr}r(h&Uh'jubah5jMubaubh)r}r(h&Uh'juh0Nh5hh7}r(Uexprhh<]h;]h9]h:]h?]uhANhBhhC]rh)r}r(h&Uh7}r(UreftypehUrefdochU refdomainhh<]h;]U refexplicith9]h:]h?]U reftargetX+_modules/autocomplete_light/channel/genericUrefidj}uh'jhC]rh)r}r(h&Uh7}r(h9]h:]rhah;]h<]h?]uh'jhC]rhLX[source]rr}r(h&Uh'jubah5hubah5hubaubeubh)r}r(h&Uh'jph0hh5hh7}r(h9]h:]h;]h<]h?]uhANhBhhC]r(hP)r}r(h&X=Return results for each queryset returned by get_querysets().rh'jh0jlh5hTh7}r(h9]h:]h;]h<]h?]uhAKhBhhC]rhLX=Return results for each queryset returned by get_querysets().rr}r(h&jh'jubaubhP)r}r(h&XNote that it limits each queryset's to self.limit_result. If you want a maximum of 12 suggestions and have a total of 4 querysets, then self.limit_results should be set to 3.rh'jh0jlh5hTh7}r(h9]h:]h;]h<]h?]uhAKhBhhC]rhLXNote that it limits each queryset's to self.limit_result. If you want a maximum of 12 suggestions and have a total of 4 querysets, then self.limit_results should be set to 3.rr}r(h&jh'jubaubeubeubh)r}r(h&Uh'hh0X/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/autocomplete_light/channel/generic.py:docstring of autocomplete_light.channel.generic.GenericChannelBase.order_resultsrh5hh7}r(h<]h;]h9]h:]h?]Uentries]r(hXNorder_results() (autocomplete_light.channel.generic.GenericChannelBase method)h UtrauhANhBhhC]ubh)r}r(h&Uh'hh0jh5hh7}r(hhXpyh<]h;]h9]h:]h?]hXmethodrhjuhANhBhhC]r(h)r}r(h&X)GenericChannelBase.order_results(results)h'jh0hh5hh7}r(h<]rh ahh1X"autocomplete_light.channel.genericrr}rbh;]h9]h:]h?]rh ahX GenericChannelBase.order_resultsrhhhuhANhBhhC]r(h)r}r(h&X order_resultsh'jh0hh5hh7}r(h9]h:]h;]h<]h?]uhANhBhhC]rhLX order_resultsrr}r(h&Uh'jubaubj?)r}r(h&Uh'jh0hh5jBh7}r(h9]h:]h;]h<]h?]uhANhBhhC]rjE)r}r(h&Xresultsh7}r(h9]h:]h;]h<]h?]uh'jhC]rhLXresultsrr}r(h&Uh'jubah5jMubaubh)r}r(h&Uh'jh0Nh5hh7}r(Uexprhh<]h;]h9]h:]h?]uhANhBhhC]rh)r}r(h&Uh7}r(UreftypehUrefdochU refdomainhh<]h;]U refexplicith9]h:]h?]U reftargetX+_modules/autocomplete_light/channel/genericUrefidjuh'jhC]rh)r}r(h&Uh7}r(h9]h:]rhah;]h<]h?]uh'jhC]rhLX[source]rr}r(h&Uh'jubah5hubah5hubaubeubh)r}r(h&Uh'jh0hh5hh7}r(h9]h:]h;]h<]h?]uhANhBhhC]r(hP)r}r(h&X/Return results, **without** doing any ordering.h'jh0jh5hTh7}r(h9]h:]h;]h<]h?]uhAKhBhhC]r(hLXReturn results, rr}r(h&XReturn results, h'jubj)r}r(h&X **without**h7}r(h9]h:]h;]h<]h?]uh'jhC]rhLXwithoutrr}r(h&Uh'jubah5jubhLX doing any ordering.rr}r(h&X doing any ordering.h'jubeubhP)r}r(h&XIn most cases, you would not have to override this method as querysets should be ordered by default, based on model.Meta.ordering.rh'jh0jh5hTh7}r(h9]h:]h;]h<]h?]uhAKhBhhC]rhLXIn most cases, you would not have to override this method as querysets should be ordered by default, based on model.Meta.ordering.rr}r(h&jh'jubaubeubeubh)r }r (h&Uh'hh0X/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/autocomplete_light/channel/generic.py:docstring of autocomplete_light.channel.generic.GenericChannelBase.result_as_valuer h5hh7}r (h<]h;]h9]h:]h?]Uentries]r (hXPresult_as_value() (autocomplete_light.channel.generic.GenericChannelBase method)hUtrauhANhBhhC]ubh)r}r(h&Uh'hh0j h5hh7}r(hhXpyh<]h;]h9]h:]h?]hXmethodrhjuhANhBhhC]r(h)r}r(h&X*GenericChannelBase.result_as_value(result)h'jh0hh5hh7}r(h<]rhahh1X"autocomplete_light.channel.genericrr}rbh;]h9]h:]h?]rhahX"GenericChannelBase.result_as_valuerhhhuhANhBhhC]r(h)r}r(h&Xresult_as_valueh'jh0hh5hh7}r (h9]h:]h;]h<]h?]uhANhBhhC]r!hLXresult_as_valuer"r#}r$(h&Uh'jubaubj?)r%}r&(h&Uh'jh0hh5jBh7}r'(h9]h:]h;]h<]h?]uhANhBhhC]r(jE)r)}r*(h&Xresulth7}r+(h9]h:]h;]h<]h?]uh'j%hC]r,hLXresultr-r.}r/(h&Uh'j)ubah5jMubaubh)r0}r1(h&Uh'jh0Nh5hh7}r2(Uexprhh<]h;]h9]h:]h?]uhANhBhhC]r3h)r4}r5(h&Uh7}r6(UreftypehUrefdochU refdomainhh<]h;]U refexplicith9]h:]h?]U reftargetX+_modules/autocomplete_light/channel/genericUrefidjuh'j0hC]r7h)r8}r9(h&Uh7}r:(h9]h:]r;hah;]h<]h?]uh'j4hC]r<hLX[source]r=r>}r?(h&Uh'j8ubah5hubah5hubaubeubh)r@}rA(h&Uh'jh0hh5hh7}rB(h9]h:]h;]h<]h?]uhANhBhhC]rC(hP)rD}rE(h&XmRely on GenericForeignKeyField to return a string containing the content type id and object id of the result.rFh'j@h0j h5hTh7}rG(h9]h:]h;]h<]h?]uhAKhBhhC]rHhLXmRely on GenericForeignKeyField to return a string containing the content type id and object id of the result.rIrJ}rK(h&jFh'jDubaubhP)rL}rM(h&XKBecause this channel is made for that field, and to avoid code duplication.rNh'j@h0j h5hTh7}rO(h9]h:]h;]h<]h?]uhAKhBhhC]rPhLXKBecause this channel is made for that field, and to avoid code duplication.rQrR}rS(h&jNh'jLubaubeubeubh)rT}rU(h&Uh'hh0X/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/autocomplete_light/channel/generic.py:docstring of autocomplete_light.channel.generic.GenericChannelBase.values_filterrVh5hh7}rW(h<]h;]h9]h:]h?]Uentries]rX(hXNvalues_filter() (autocomplete_light.channel.generic.GenericChannelBase method)hUtrYauhANhBhhC]ubh)rZ}r[(h&Uh'hh0jVh5hh7}r\(hhXpyh<]h;]h9]h:]h?]hXmethodr]hj]uhANhBhhC]r^(h)r_}r`(h&X1GenericChannelBase.values_filter(results, values)h'jZh0hh5hh7}ra(h<]rbhahh1X"autocomplete_light.channel.genericrcrd}rebh;]h9]h:]h?]rfhahX GenericChannelBase.values_filterrghhhuhANhBhhC]rh(h)ri}rj(h&X values_filterh'j_h0hh5hh7}rk(h9]h:]h;]h<]h?]uhANhBhhC]rlhLX values_filterrmrn}ro(h&Uh'jiubaubj?)rp}rq(h&Uh'j_h0hh5jBh7}rr(h9]h:]h;]h<]h?]uhANhBhhC]rs(jE)rt}ru(h&Xresultsh7}rv(h9]h:]h;]h<]h?]uh'jphC]rwhLXresultsrxry}rz(h&Uh'jtubah5jMubjE)r{}r|(h&Xvaluesh7}r}(h9]h:]h;]h<]h?]uh'jphC]r~hLXvaluesrr}r(h&Uh'j{ubah5jMubeubh)r}r(h&Uh'j_h0Nh5hh7}r(Uexprhh<]h;]h9]h:]h?]uhANhBhhC]rh)r}r(h&Uh7}r(UreftypehUrefdochU refdomainhh<]h;]U refexplicith9]h:]h?]U reftargetX+_modules/autocomplete_light/channel/genericUrefidjguh'jhC]rh)r}r(h&Uh7}r(h9]h:]rhah;]h<]h?]uh'jhC]rhLX[source]rr}r(h&Uh'jubah5hubah5hubaubeubh)r}r(h&Uh'jZh0hh5hh7}r(h9]h:]h;]h<]h?]uhANhBhhC]rhP)r}r(h&XDFilter out any result from results that is not refered to by values.rh'jh0jVh5hTh7}r(h9]h:]h;]h<]h?]uhAKhBhhC]rhLXDFilter out any result from results that is not refered to by values.rr}r(h&jh'jubaubaubeubeubeubcdocutils.nodes target r)r}r(h&X.. _generic-fk:h'hh0h3h5Utargetrh7}r(h<]h;]h9]h:]h?]UrefidrU generic-fkruhAKhBhhC]ubeubeubh,h()r}r(h&Uh'h.h0h3Uexpect_referenced_by_namer}rh j)r}r(h&X.. _generic-m2m:h'h()r}r(h&Uh+Kh'h,h0h3h5h6h7}r(h9]rhah:]h;]h<]rUid2rah?]uhAK!hBhhC]r(hE)r}r(h&XAPIrh'jh0h3h5hIh7}r(h9]h:]h;]h<]h?]uhAK!hBhhC]rhLXAPIrr}r(h&jh'jubaubj)r}r(h&Uh'jh0hh5jh7}r(h9]h<]rX!module-autocomplete_light.genericrah;]Uismodh:]h?]uhAKhBhhC]ubh)r}r(h&Uh'jh0hh5hh7}r(h<]h;]h9]h:]h?]Uentries]r(hX#autocomplete_light.generic (module)X!module-autocomplete_light.genericUtrauhAKhBhhC]ubh)r}r(h&Uh'jh0Nh5hh7}r(h<]h;]h9]h:]h?]Uentries]r(hX6GenericModelForm (class in autocomplete_light.generic)hUtrauhANhBhhC]ubh)r}r(h&Uh'jh0Nh5hh7}r(hhXpyh<]h;]h9]h:]h?]hXclassrhjuhANhBhhC]r(h)r}r(h&X!GenericModelForm(*args, **kwargs)h'jh0hh5hh7}r(h<]rhahh1Xautocomplete_light.genericrr}rbh;]h9]h:]h?]rhahXGenericModelFormrhUhuhANhBhhC]r(h)r}r(h&Xclass h'jh0hh5hh7}r(h9]h:]h;]h<]h?]uhANhBhhC]rhLXclass rr}r(h&Uh'jubaubh)r}r(h&Xautocomplete_light.generic.h'jh0hh5hh7}r(h9]h:]h;]h<]h?]uhANhBhhC]rhLXautocomplete_light.generic.rr}r(h&Uh'jubaubh)r}r(h&jh'jh0hh5hh7}r(h9]h:]h;]h<]h?]uhANhBhhC]rhLXGenericModelFormrr}r(h&Uh'jubaubj?)r}r(h&Uh'jh0hh5jBh7}r(h9]h:]h;]h<]h?]uhANhBhhC]r(jE)r}r(h&X*argsh7}r(h9]h:]h;]h<]h?]uh'jhC]rhLX*argsrr}r(h&Uh'jubah5jMubjE)r}r(h&X**kwargsh7}r(h9]h:]h;]h<]h?]uh'jhC]rhLX**kwargsrr}r(h&Uh'jubah5jMubeubh)r}r(h&Uh'jh0Nh5hh7}r(Uexprhh<]h;]h9]h:]h?]uhANhBhhC]rh)r}r(h&Uh7}r(UreftypehUrefdochU refdomainhh<]h;]U refexplicith9]h:]h?]U reftargetX#_modules/autocomplete_light/genericUrefidjuh'jhC]rh)r}r(h&Uh7}r (h9]h:]r hah;]h<]h?]uh'jhC]r hLX[source]r r }r(h&Uh'jubah5hubah5hubaubeubh)r}r(h&Uh'jh0hh5hh7}r(h9]h:]h;]h<]h?]uhANhBhhC]r(hP)r}r(h&XSThis simple subclass of ModelForm fixes a couple of issues with django's ModelForm.rh'jh0X/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/autocomplete_light/generic.py:docstring of autocomplete_light.generic.GenericModelFormrh5hTh7}r(h9]h:]h;]h<]h?]uhAKhBhhC]rhLXSThis simple subclass of ModelForm fixes a couple of issues with django's ModelForm.rr}r(h&jh'jubaubcdocutils.nodes bullet_list r)r}r(h&Uh'jh0jh5U bullet_listrh7}r (Ubulletr!X-h<]h;]h9]h:]h?]uhAKhBhhC]r"(cdocutils.nodes list_item r#)r$}r%(h&Xktreat virtual fields like GenericForeignKey as normal fields, Django should already do that but it doesn't,h'jh0jh5U list_itemr&h7}r'(h9]h:]h;]h<]h?]uhANhBhhC]r(hP)r)}r*(h&Xktreat virtual fields like GenericForeignKey as normal fields, Django should already do that but it doesn't,r+h'j$h0jh5hTh7}r,(h9]h:]h;]h<]h?]uhAKhC]r-hLXktreat virtual fields like GenericForeignKey as normal fields, Django should already do that but it doesn't,r.r/}r0(h&j+h'j)ubaubaubj#)r1}r2(h&Xwhen setting a GenericForeignKey value, also set the object id and content type id fields, again Django could probably afford to do that. h'jh0jh5j&h7}r3(h9]h:]h;]h<]h?]uhANhBhhC]r4hP)r5}r6(h&Xwhen setting a GenericForeignKey value, also set the object id and content type id fields, again Django could probably afford to do that.r7h'j1h0jh5hTh7}r8(h9]h:]h;]h<]h?]uhAKhC]r9hLXwhen setting a GenericForeignKey value, also set the object id and content type id fields, again Django could probably afford to do that.r:r;}r<(h&j7h'j5ubaubaubeubhP)r=}r>(h&XGWhat ModelForm does, but also add virtual field values to self.initial.r?h'jh0jh5hTh7}r@(h9]h:]h;]h<]h?]uhAK hBhhC]rAhLXGWhat ModelForm does, but also add virtual field values to self.initial.rBrC}rD(h&j?h'j=ubaubh)rE}rF(h&Uh'jh0X/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/autocomplete_light/generic.py:docstring of autocomplete_light.generic.GenericModelForm.saverGh5hh7}rH(h<]h;]h9]h:]h?]Uentries]rI(hX;save() (autocomplete_light.generic.GenericModelForm method)hUtrJauhANhBhhC]ubh)rK}rL(h&Uh'jh0jGh5hh7}rM(hhXpyh<]h;]h9]h:]h?]hXmethodrNhjNuhANhBhhC]rO(h)rP}rQ(h&X"GenericModelForm.save(commit=True)h'jKh0hh5hh7}rR(h<]rShahh1Xautocomplete_light.genericrTrU}rVbh;]h9]h:]h?]rWhahXGenericModelForm.saverXhjhuhANhBhhC]rY(h)rZ}r[(h&Xsaveh'jPh0hh5hh7}r\(h9]h:]h;]h<]h?]uhANhBhhC]r]hLXsaver^r_}r`(h&Uh'jZubaubj?)ra}rb(h&Uh'jPh0hh5jBh7}rc(h9]h:]h;]h<]h?]uhANhBhhC]rdjE)re}rf(h&X commit=Trueh7}rg(h9]h:]h;]h<]h?]uh'jahC]rhhLX commit=Truerirj}rk(h&Uh'jeubah5jMubaubh)rl}rm(h&Uh'jPh0Nh5hh7}rn(Uexprhh<]h;]h9]h:]h?]uhANhBhhC]roh)rp}rq(h&Uh7}rr(UreftypehUrefdochU refdomainhh<]h;]U refexplicith9]h:]h?]U reftargetX#_modules/autocomplete_light/genericUrefidjXuh'jlhC]rsh)rt}ru(h&Uh7}rv(h9]h:]rwhah;]h<]h?]uh'jphC]rxhLX[source]ryrz}r{(h&Uh'jtubah5hubah5hubaubeubh)r|}r}(h&Uh'jKh0hh5hh7}r~(h9]h:]h;]h<]h?]uhANhBhhC]r(hP)r}r(h&XdWhat ModelForm does, but also set GFK.ct_field and GFK.fk_field if such a virtual field has a value.rh'j|h0jGh5hTh7}r(h9]h:]h;]h<]h?]uhAKhBhhC]rhLXdWhat ModelForm does, but also set GFK.ct_field and GFK.fk_field if such a virtual field has a value.rr}r(h&jh'jubaubhP)r}r(h&XlThis should probably be done in the GFK field itself, but it's here for convenience until Django fixes that.rh'j|h0jGh5hTh7}r(h9]h:]h;]h<]h?]uhAKhBhhC]rhLXlThis should probably be done in the GFK field itself, but it's here for convenience until Django fixes that.rr}r(h&jh'jubaubeubeubeubeubh)r}r(h&Uh'jh0Nh5hh7}r(h<]h;]h9]h:]h?]Uentries]r(hX<GenericForeignKeyField (class in autocomplete_light.generic)hUtrauhANhBhhC]ubh)r}r(h&Uh'jh0Nh5hh7}r(hhXpyh<]h;]h9]h:]h?]hXclassrhjuhANhBhhC]r(h)r}r(h&XGenericForeignKeyField(required=True, widget=None, label=None, initial=None, help_text=None, error_messages=None, show_hidden_initial=False, validators=[], localize=False)h'jh0hh5hh7}r(h<]rhahh1Xautocomplete_light.genericrr}rbh;]h9]h:]h?]rhahXGenericForeignKeyFieldrhUhuhANhBhhC]r(h)r}r(h&Xclass h'jh0hh5hh7}r(h9]h:]h;]h<]h?]uhANhBhhC]rhLXclass rr}r(h&Uh'jubaubh)r}r(h&Xautocomplete_light.generic.h'jh0hh5hh7}r(h9]h:]h;]h<]h?]uhANhBhhC]rhLXautocomplete_light.generic.rr}r(h&Uh'jubaubh)r}r(h&jh'jh0hh5hh7}r(h9]h:]h;]h<]h?]uhANhBhhC]rhLXGenericForeignKeyFieldrr}r(h&Uh'jubaubj?)r}r(h&Uh'jh0hh5jBh7}r(h9]h:]h;]h<]h?]uhANhBhhC]r(jE)r}r(h&X required=Trueh7}r(h9]h:]h;]h<]h?]uh'jhC]rhLX required=Truerr}r(h&Uh'jubah5jMubjE)r}r(h&X widget=Noneh7}r(h9]h:]h;]h<]h?]uh'jhC]rhLX widget=Nonerr}r(h&Uh'jubah5jMubjE)r}r(h&X label=Noneh7}r(h9]h:]h;]h<]h?]uh'jhC]rhLX label=Nonerr}r(h&Uh'jubah5jMubjE)r}r(h&X initial=Noneh7}r(h9]h:]h;]h<]h?]uh'jhC]rhLX initial=Nonerr}r(h&Uh'jubah5jMubjE)r}r(h&Xhelp_text=Noneh7}r(h9]h:]h;]h<]h?]uh'jhC]rhLXhelp_text=Nonerr}r(h&Uh'jubah5jMubjE)r}r(h&Xerror_messages=Noneh7}r(h9]h:]h;]h<]h?]uh'jhC]rhLXerror_messages=Nonerr}r(h&Uh'jubah5jMubjE)r}r(h&Xshow_hidden_initial=Falseh7}r(h9]h:]h;]h<]h?]uh'jhC]rhLXshow_hidden_initial=Falserr}r(h&Uh'jubah5jMubjE)r}r(h&X validators=h7}r(h9]h:]h;]h<]h?]uh'jhC]rhLX validators=rr}r(h&Uh'jubah5jMubcsphinx.addnodes desc_optional r)r}r(h&Uh7}r(h9]h:]h;]h<]h?]uh'jhC]h5U desc_optionalrubjE)r}r(h&Xlocalize=Falseh7}r(h9]h:]h;]h<]h?]uh'jhC]rhLXlocalize=Falserr}r(h&Uh'jubah5jMubeubh)r}r(h&Uh'jh0Nh5hh7}r(Uexprhh<]h;]h9]h:]h?]uhANhBhhC]rh)r}r(h&Uh7}r(UreftypehUrefdochU refdomainhh<]h;]U refexplicith9]h:]h?]U reftargetX#_modules/autocomplete_light/genericUrefidjuh'jhC]rh)r }r (h&Uh7}r (h9]h:]r hah;]h<]h?]uh'jhC]r hLX[source]rr}r(h&Uh'j ubah5hubah5hubaubeubh)r}r(h&Uh'jh0hh5hh7}r(h9]h:]h;]h<]h?]uhANhBhhC]r(hP)r}r(h&X2Simple form field that converts strings to models.rh'jh0X/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/autocomplete_light/generic.py:docstring of autocomplete_light.generic.GenericForeignKeyFieldrh5hTh7}r(h9]h:]h;]h<]h?]uhAKhBhhC]rhLX2Simple form field that converts strings to models.rr}r(h&jh'jubaubh)r}r(h&Uh'jh0X/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/autocomplete_light/generic.py:docstring of autocomplete_light.generic.GenericForeignKeyField.prepare_valuer h5hh7}r!(h<]h;]h9]h:]h?]Uentries]r"(hXJprepare_value() (autocomplete_light.generic.GenericForeignKeyField method)hUtr#auhANhBhhC]ubh)r$}r%(h&Uh'jh0j h5hh7}r&(hhXpyh<]h;]h9]h:]h?]hXmethodr'hj'uhANhBhhC]r((h)r)}r*(h&X+GenericForeignKeyField.prepare_value(value)h'j$h0hh5hh7}r+(h<]r,hahh1Xautocomplete_light.genericr-r.}r/bh;]h9]h:]h?]r0hahX$GenericForeignKeyField.prepare_valuer1hjhuhANhBhhC]r2(h)r3}r4(h&X prepare_valueh'j)h0hh5hh7}r5(h9]h:]h;]h<]h?]uhANhBhhC]r6hLX prepare_valuer7r8}r9(h&Uh'j3ubaubj?)r:}r;(h&Uh'j)h0hh5jBh7}r<(h9]h:]h;]h<]h?]uhANhBhhC]r=jE)r>}r?(h&Xvalueh7}r@(h9]h:]h;]h<]h?]uh'j:hC]rAhLXvaluerBrC}rD(h&Uh'j>ubah5jMubaubh)rE}rF(h&Uh'j)h0Nh5hh7}rG(Uexprhh<]h;]h9]h:]h?]uhANhBhhC]rHh)rI}rJ(h&Uh7}rK(UreftypehUrefdochU refdomainhh<]h;]U refexplicith9]h:]h?]U reftargetX#_modules/autocomplete_light/genericUrefidj1uh'jEhC]rLh)rM}rN(h&Uh7}rO(h9]h:]rPhah;]h<]h?]uh'jIhC]rQhLX[source]rRrS}rT(h&Uh'jMubah5hubah5hubaubeubh)rU}rV(h&Uh'j$h0hh5hh7}rW(h9]h:]h;]h<]h?]uhANhBhhC]rXhP)rY}rZ(h&XcGiven a model instance as value, with content type id of 3 and pk of 5, return such a string '3-5'.r[h'jUh0j h5hTh7}r\(h9]h:]h;]h<]h?]uhAKhBhhC]r]hLXcGiven a model instance as value, with content type id of 3 and pk of 5, return such a string '3-5'.r^r_}r`(h&j[h'jYubaubaubeubh)ra}rb(h&Uh'jh0X/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/autocomplete_light/generic.py:docstring of autocomplete_light.generic.GenericForeignKeyField.to_pythonrch5hh7}rd(h<]h;]h9]h:]h?]Uentries]re(hXFto_python() (autocomplete_light.generic.GenericForeignKeyField method)hUtrfauhANhBhhC]ubh)rg}rh(h&Uh'jh0jch5hh7}ri(hhXpyh<]h;]h9]h:]h?]hXmethodrjhjjuhANhBhhC]rk(h)rl}rm(h&X'GenericForeignKeyField.to_python(value)h'jgh0hh5hh7}rn(h<]rohahh1Xautocomplete_light.genericrprq}rrbh;]h9]h:]h?]rshahX GenericForeignKeyField.to_pythonrthjhuhANhBhhC]ru(h)rv}rw(h&X to_pythonh'jlh0hh5hh7}rx(h9]h:]h;]h<]h?]uhANhBhhC]ryhLX to_pythonrzr{}r|(h&Uh'jvubaubj?)r}}r~(h&Uh'jlh0hh5jBh7}r(h9]h:]h;]h<]h?]uhANhBhhC]rjE)r}r(h&Xvalueh7}r(h9]h:]h;]h<]h?]uh'j}hC]rhLXvaluerr}r(h&Uh'jubah5jMubaubh)r}r(h&Uh'jlh0Nh5hh7}r(Uexprhh<]h;]h9]h:]h?]uhANhBhhC]rh)r}r(h&Uh7}r(UreftypehUrefdochU refdomainhh<]h;]U refexplicith9]h:]h?]U reftargetX#_modules/autocomplete_light/genericUrefidjtuh'jhC]rh)r}r(h&Uh7}r(h9]h:]rhah;]h<]h?]uh'jhC]rhLX[source]rr}r(h&Uh'jubah5hubah5hubaubeubh)r}r(h&Uh'jgh0hh5hh7}r(h9]h:]h;]h<]h?]uhANhBhhC]rhP)r}r(h&XJGiven a string like '3-5', return the model of content type id 3 and pk 5.rh'jh0jch5hTh7}r(h9]h:]h;]h<]h?]uhAKhBhhC]rhLXJGiven a string like '3-5', return the model of content type id 3 and pk 5.rr}r(h&jh'jubaubaubeubeubeubjeubh0h3h5jh7}r(h<]h;]h9]h:]h?]jU generic-m2mruhAK&hBhhC]ubsh5h6h7}r(h9]h:]h;]h<]r(Ugenericmanytomanyrjeh?]r(h h euhAK)hBhUexpect_referenced_by_idr}rjjshC]r(hE)r}r(h&XGenericManyToManyrh'jh0h3h5hIh7}r(h9]h:]h;]h<]h?]uhAK)hBhhC]rhLXGenericManyToManyrr}r(h&jh'jubaubh()r}r(h&Uh+Kh'jh0h3h5h6h7}r(h9]rXexamplerah:]h;]h<]rUid3rah?]uhAK,hBhhC]r(hE)r}r(h&XExamplerh'jh0h3h5hIh7}r(h9]h:]h;]h<]h?]uhAK,hBhhC]rhLXExamplerr}r(h&jh'jubaubhP)r}r(h&XExample model with ``related``:rh'jh0h3h5hTh7}r(h9]h:]h;]h<]h?]uhAK.hBhhC]r(hLXExample model with rr}r(h&XExample model with h'jubcdocutils.nodes literal r)r}r(h&X ``related``h7}r(h9]h:]h;]h<]h?]uh'jhC]rhLXrelatedrr}r(h&Uh'jubah5UliteralrubhLX:r}r(h&X:h'jubeubhy)r}r(h&XVfrom django.db import models from django.db.models import signals from django.contrib.contenttypes import generic from genericm2m.models import RelatedObjectsDescriptor class ModelGroup(models.Model): name = models.CharField(max_length=100) related = RelatedObjectsDescriptor() def __unicode__(self): return self.name h'jh0h3h5h|h7}r(h~h1Xpythonrr}rbh9]hhh<]h;]UsourceX/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/docs/source/../../test_project/generic_m2m_example/models.pyh:]h?]uhAK0hBhhC]rhLXVfrom django.db import models from django.db.models import signals from django.contrib.contenttypes import generic from genericm2m.models import RelatedObjectsDescriptor class ModelGroup(models.Model): name = models.CharField(max_length=100) related = RelatedObjectsDescriptor() def __unicode__(self): return self.name rr}r(h&Uh'jubaubhP)r}r(h&X/Example ``generic_m2m.GenericModelForm`` usage:rh'jh0h3h5hTh7}r(h9]h:]h;]h<]h?]uhAK3hBhhC]r(hLXExample rr}r(h&XExample h'jubj)r}r(h&X ``generic_m2m.GenericModelForm``h7}r(h9]h:]h;]h<]h?]uh'jhC]rhLXgeneric_m2m.GenericModelFormrr}r(h&Uh'jubah5jubhLX usage:rr}r(h&X usage:h'jubeubhy)r}r(h&XWimport autocomplete_light from autocomplete_light.contrib.generic_m2m import GenericModelForm, \ GenericManyToMany from models import ModelGroup class ModelGroupForm(GenericModelForm): related = GenericManyToMany( widget=autocomplete_light.AutocompleteWidget('MyGenericChannel')) class Meta: model = ModelGroup h'jh0h3h5h|h7}r(h~h1Xpythonrr}rbh9]hhh<]h;]UsourceX/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/docs/source/../../test_project/generic_m2m_example/forms.pyh:]h?]uhAK5hBhhC]rhLXWimport autocomplete_light from autocomplete_light.contrib.generic_m2m import GenericModelForm, \ GenericManyToMany from models import ModelGroup class ModelGroupForm(GenericModelForm): related = GenericManyToMany( widget=autocomplete_light.AutocompleteWidget('MyGenericChannel')) class Meta: model = ModelGroup rr}r(h&Uh'jubaubhP)r}r(h&XExample ``ModelAdmin``:rh'jh0h3h5hTh7}r(h9]h:]h;]h<]h?]uhAK8hBhhC]r(hLXExample rr}r(h&XExample h'jubj)r}r(h&X``ModelAdmin``h7}r(h9]h:]h;]h<]h?]uh'jhC]r hLX ModelAdminr r }r (h&Uh'jubah5jubhLX:r }r(h&X:h'jubeubhy)r}r(h&Xfrom django.contrib import admin from models import ModelGroup from forms import ModelGroupForm class ModelGroupAdmin(admin.ModelAdmin): form = ModelGroupForm admin.site.register(ModelGroup, ModelGroupAdmin) h'jh0h3h5h|h7}r(h~h1Xpythonrr}rbh9]hhh<]h;]UsourceX/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/docs/source/../../test_project/generic_m2m_example/admin.pyh:]h?]uhAK:hBhhC]rhLXfrom django.contrib import admin from models import ModelGroup from forms import ModelGroupForm class ModelGroupAdmin(admin.ModelAdmin): form = ModelGroupForm admin.site.register(ModelGroup, ModelGroupAdmin) rr}r(h&Uh'jubaubeubh()r}r(h&Uh+Kh'jh0h3h5h6h7}r(h9]rXapirah:]h;]h<]rUid4rah?]uhAK>hBhhC]r (hE)r!}r"(h&XAPIr#h'jh0h3h5hIh7}r$(h9]h:]h;]h<]h?]uhAK>hBhhC]r%hLXAPIr&r'}r((h&j#h'j!ubaubj)r)}r*(h&Uh'jh0hh5jh7}r+(h9]h<]r,X-module-autocomplete_light.contrib.generic_m2mr-ah;]Uismodh:]h?]uhAKhBhhC]ubh)r.}r/(h&Uh'jh0hh5hh7}r0(h<]h;]h9]h:]h?]Uentries]r1(hX/autocomplete_light.contrib.generic_m2m (module)X-module-autocomplete_light.contrib.generic_m2mUtr2auhAKhBhhC]ubhP)r3}r4(h&Xe``autocomplete_light.contrib.generic_m2m`` couples django-autocomplete-light with django-generic-m2m.h'jh0X/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/autocomplete_light/contrib/generic_m2m.py:docstring of autocomplete_light.contrib.generic_m2mr5h5hTh7}r6(h9]h:]h;]h<]h?]uhAKhBhhC]r7(j)r8}r9(h&X*``autocomplete_light.contrib.generic_m2m``h7}r:(h9]h:]h;]h<]h?]uh'j3hC]r;hLX&autocomplete_light.contrib.generic_m2mr<r=}r>(h&Uh'j8ubah5jubhLX; couples django-autocomplete-light with django-generic-m2m.r?r@}rA(h&X; couples django-autocomplete-light with django-generic-m2m.h'j3ubeubhP)rB}rC(h&XGeneric many to many are supported since 0.5. It depends on `django-generic-m2m `_ external apps. Follow django-generic-m2m installation documentation, but at the time of writing it barely consists of adding the ``genericm2m`` to ``INSTALLED_APPS``, and adding a field to models that should have a generic m2m relation. So, kudos to the maintainers of django-generic-m2m, fantastic app, use it for generic many to many relations.h'jh0j5h5hTh7}rD(h9]h:]h;]h<]h?]uhAKhBhhC]rE(hLX<Generic many to many are supported since 0.5. It depends on rFrG}rH(h&X<Generic many to many are supported since 0.5. It depends on h'jBubcdocutils.nodes reference rI)rJ}rK(h&X:`django-generic-m2m `_h7}rL(UnamehUrefurirMX"http://django-generic-m2m.rtfd.orgrNh<]h;]h9]h:]h?]uh'jBhC]rOhLXdjango-generic-m2mrPrQ}rR(h&Uh'jJubah5U referencerSubj)rT}rU(h&X% h+Kh'jBh5jh7}rV(UrefurijNh<]rWUdjango-generic-m2mrXah;]h9]h:]h?]rYhauhC]ubhLX external apps. Follow django-generic-m2m installation documentation, but at the time of writing it barely consists of adding the rZr[}r\(h&X external apps. Follow django-generic-m2m installation documentation, but at the time of writing it barely consists of adding the h'jBubj)r]}r^(h&X``genericm2m``h7}r_(h9]h:]h;]h<]h?]uh'jBhC]r`hLX genericm2mrarb}rc(h&Uh'j]ubah5jubhLX to rdre}rf(h&X to h'jBubj)rg}rh(h&X``INSTALLED_APPS``h7}ri(h9]h:]h;]h<]h?]uh'jBhC]rjhLXINSTALLED_APPSrkrl}rm(h&Uh'jgubah5jubhLX, and adding a field to models that should have a generic m2m relation. So, kudos to the maintainers of django-generic-m2m, fantastic app, use it for generic many to many relations.rnro}rp(h&X, and adding a field to models that should have a generic m2m relation. So, kudos to the maintainers of django-generic-m2m, fantastic app, use it for generic many to many relations.h'jBubeubhP)rq}rr(h&X5See examples in ``test_project/generic_m2m_example``.rsh'jh0j5h5hTh7}rt(h9]h:]h;]h<]h?]uhAK hBhhC]ru(hLXSee examples in rvrw}rx(h&XSee examples in h'jqubj)ry}rz(h&X$``test_project/generic_m2m_example``h7}r{(h9]h:]h;]h<]h?]uh'jqhC]r|hLX test_project/generic_m2m_exampler}r~}r(h&Uh'jyubah5jubhLX.r}r(h&X.h'jqubeubh)r}r(h&Uh'jh0X/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/autocomplete_light/contrib/generic_m2m.py:docstring of autocomplete_light.contrib.generic_m2m.GenericManyToManyrh5hh7}r(h<]h;]h9]h:]h?]Uentries]r(hXCGenericManyToMany (class in autocomplete_light.contrib.generic_m2m)hUtrauhANhBhhC]ubh)r}r(h&Uh'jh0jh5hh7}r(hhXpyh<]h;]h9]h:]h?]hXclassrhjuhANhBhhC]r(h)r}r(h&XGenericManyToMany(required=True, widget=None, label=None, initial=None, help_text=None, error_messages=None, show_hidden_initial=False, validators=[], localize=False)h'jh0hh5hh7}r(h<]rhahh1X&autocomplete_light.contrib.generic_m2mrr}rbh;]h9]h:]h?]rhahXGenericManyToManyrhUhuhANhBhhC]r(h)r}r(h&Xclass h'jh0hh5hh7}r(h9]h:]h;]h<]h?]uhANhBhhC]rhLXclass rr}r(h&Uh'jubaubh)r}r(h&X'autocomplete_light.contrib.generic_m2m.h'jh0hh5hh7}r(h9]h:]h;]h<]h?]uhANhBhhC]rhLX'autocomplete_light.contrib.generic_m2m.rr}r(h&Uh'jubaubh)r}r(h&jh'jh0hh5hh7}r(h9]h:]h;]h<]h?]uhANhBhhC]rhLXGenericManyToManyrr}r(h&Uh'jubaubj?)r}r(h&Uh'jh0hh5jBh7}r(h9]h:]h;]h<]h?]uhANhBhhC]r(jE)r}r(h&X required=Trueh7}r(h9]h:]h;]h<]h?]uh'jhC]rhLX required=Truerr}r(h&Uh'jubah5jMubjE)r}r(h&X widget=Noneh7}r(h9]h:]h;]h<]h?]uh'jhC]rhLX widget=Nonerr}r(h&Uh'jubah5jMubjE)r}r(h&X label=Noneh7}r(h9]h:]h;]h<]h?]uh'jhC]rhLX label=Nonerr}r(h&Uh'jubah5jMubjE)r}r(h&X initial=Noneh7}r(h9]h:]h;]h<]h?]uh'jhC]rhLX initial=Nonerr}r(h&Uh'jubah5jMubjE)r}r(h&Xhelp_text=Noneh7}r(h9]h:]h;]h<]h?]uh'jhC]rhLXhelp_text=Nonerr}r(h&Uh'jubah5jMubjE)r}r(h&Xerror_messages=Noneh7}r(h9]h:]h;]h<]h?]uh'jhC]rhLXerror_messages=Nonerr}r(h&Uh'jubah5jMubjE)r}r(h&Xshow_hidden_initial=Falseh7}r(h9]h:]h;]h<]h?]uh'jhC]rhLXshow_hidden_initial=Falserr}r(h&Uh'jubah5jMubjE)r}r(h&X validators=h7}r(h9]h:]h;]h<]h?]uh'jhC]rhLX validators=rr}r(h&Uh'jubah5jMubj)r}r(h&Uh7}r(h9]h:]h;]h<]h?]uh'jhC]h5jubjE)r}r(h&Xlocalize=Falseh7}r(h9]h:]h;]h<]h?]uh'jhC]rhLXlocalize=Falserr}r(h&Uh'jubah5jMubeubh)r}r(h&Uh'jh0Nh5hh7}r(Uexprhh<]h;]h9]h:]h?]uhANhBhhC]rh)r}r(h&Uh7}r(UreftypehUrefdochU refdomainhh<]h;]U refexplicith9]h:]h?]U reftargetX/_modules/autocomplete_light/contrib/generic_m2mUrefidjuh'jhC]rh)r}r(h&Uh7}r(h9]h:]rhah;]h<]h?]uh'jhC]rhLX[source]rr}r(h&Uh'jubah5hubah5hubaubeubh)r}r(h&Uh'jh0hh5hh7}r(h9]h:]h;]h<]h?]uhANhBhhC]rhP)r}r(h&X2Simple form field that converts strings to models.rh'jh0jh5hTh7}r (h9]h:]h;]h<]h?]uhAKhBhhC]r hLX2Simple form field that converts strings to models.r r }r (h&jh'jubaubaubeubh)r}r(h&Uh'jh0Nh5hh7}r(h<]h;]h9]h:]h?]Uentries]r(hXBGenericModelForm (class in autocomplete_light.contrib.generic_m2m)h UtrauhANhBhhC]ubh)r}r(h&Uh'jh0Nh5hh7}r(hhXpyh<]h;]h9]h:]h?]hXclassrhjuhANhBhhC]r(h)r}r(h&X!GenericModelForm(*args, **kwargs)h'jh0hh5hh7}r(h<]rh ahh1X&autocomplete_light.contrib.generic_m2mrr}rbh;]h9]h:]h?]rh ahXGenericModelFormr hUhuhANhBhhC]r!(h)r"}r#(h&Xclass h'jh0hh5hh7}r$(h9]h:]h;]h<]h?]uhANhBhhC]r%hLXclass r&r'}r((h&Uh'j"ubaubh)r)}r*(h&X'autocomplete_light.contrib.generic_m2m.h'jh0hh5hh7}r+(h9]h:]h;]h<]h?]uhANhBhhC]r,hLX'autocomplete_light.contrib.generic_m2m.r-r.}r/(h&Uh'j)ubaubh)r0}r1(h&j h'jh0hh5hh7}r2(h9]h:]h;]h<]h?]uhANhBhhC]r3hLXGenericModelFormr4r5}r6(h&Uh'j0ubaubj?)r7}r8(h&Uh'jh0hh5jBh7}r9(h9]h:]h;]h<]h?]uhANhBhhC]r:(jE)r;}r<(h&X*argsh7}r=(h9]h:]h;]h<]h?]uh'j7hC]r>hLX*argsr?r@}rA(h&Uh'j;ubah5jMubjE)rB}rC(h&X**kwargsh7}rD(h9]h:]h;]h<]h?]uh'j7hC]rEhLX**kwargsrFrG}rH(h&Uh'jBubah5jMubeubh)rI}rJ(h&Uh'jh0Nh5hh7}rK(Uexprhh<]h;]h9]h:]h?]uhANhBhhC]rLh)rM}rN(h&Uh7}rO(UreftypehUrefdochU refdomainhh<]h;]U refexplicith9]h:]h?]U reftargetX/_modules/autocomplete_light/contrib/generic_m2mUrefidj uh'jIhC]rPh)rQ}rR(h&Uh7}rS(h9]h:]rThah;]h<]h?]uh'jMhC]rUhLX[source]rVrW}rX(h&Uh'jQubah5hubah5hubaubeubh)rY}rZ(h&Uh'jh0hh5hh7}r[(h9]h:]h;]h<]h?]uhANhBhhC]r\(hP)r]}r^(h&XeExtension of autocomplete_light.GenericModelForm, that handles genericm2m's RelatedObjectsDescriptor.r_h'jYh0X/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/autocomplete_light/contrib/generic_m2m.py:docstring of autocomplete_light.contrib.generic_m2m.GenericModelFormr`h5hTh7}ra(h9]h:]h;]h<]h?]uhAKhBhhC]rbhLXeExtension of autocomplete_light.GenericModelForm, that handles genericm2m's RelatedObjectsDescriptor.rcrd}re(h&j_h'j]ubaubhP)rf}rg(h&X:Add related objects to initial for each generic m2m field.rhh'jYh0j`h5hTh7}ri(h9]h:]h;]h<]h?]uhAKhBhhC]rjhLX:Add related objects to initial for each generic m2m field.rkrl}rm(h&jhh'jfubaubh)rn}ro(h&Uh'jYh0X/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/autocomplete_light/contrib/generic_m2m.py:docstring of autocomplete_light.contrib.generic_m2m.GenericModelForm.generic_m2m_fieldsrph5hh7}rq(h<]h;]h9]h:]h?]Uentries]rr(hXUgeneric_m2m_fields() (autocomplete_light.contrib.generic_m2m.GenericModelForm method)hUtrsauhANhBhhC]ubh)rt}ru(h&Uh'jYh0jph5hh7}rv(hhXpyh<]h;]h9]h:]h?]hXmethodrwhjwuhANhBhhC]rx(h)ry}rz(h&X%GenericModelForm.generic_m2m_fields()h'jth0hh5hh7}r{(h<]r|hahh1X&autocomplete_light.contrib.generic_m2mr}r~}rbh;]h9]h:]h?]rhahX#GenericModelForm.generic_m2m_fieldsrhj huhANhBhhC]r(h)r}r(h&Xgeneric_m2m_fieldsh'jyh0hh5hh7}r(h9]h:]h;]h<]h?]uhANhBhhC]rhLXgeneric_m2m_fieldsrr}r(h&Uh'jubaubj?)r}r(h&Uh'jyh0hh5jBh7}r(h9]h:]h;]h<]h?]uhANhBhhC]ubh)r}r(h&Uh'jyh0Nh5hh7}r(Uexprhh<]h;]h9]h:]h?]uhANhBhhC]rh)r}r(h&Uh7}r(UreftypehUrefdochU refdomainhh<]h;]U refexplicith9]h:]h?]U reftargetX/_modules/autocomplete_light/contrib/generic_m2mUrefidjuh'jhC]rh)r}r(h&Uh7}r(h9]h:]rhah;]h<]h?]uh'jhC]rhLX[source]rr}r(h&Uh'jubah5hubah5hubaubeubh)r}r(h&Uh'jth0hh5hh7}r(h9]h:]h;]h<]h?]uhANhBhhC]rhP)r}r(h&XSYield name, field for each RelatedObjectsDescriptor of the model of this ModelForm.rh'jh0jph5hTh7}r(h9]h:]h;]h<]h?]uhAKhBhhC]rhLXSYield name, field for each RelatedObjectsDescriptor of the model of this ModelForm.rr}r(h&jh'jubaubaubeubh)r}r(h&Uh'jYh0X/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/autocomplete_light/contrib/generic_m2m.py:docstring of autocomplete_light.contrib.generic_m2m.GenericModelForm.saverh5hh7}r(h<]h;]h9]h:]h?]Uentries]r(hXGsave() (autocomplete_light.contrib.generic_m2m.GenericModelForm method)hUtrauhANhBhhC]ubh)r}r(h&Uh'jYh0jh5hh7}r(hhXpyh<]h;]h9]h:]h?]hXmethodrhjuhANhBhhC]r(h)r}r(h&X"GenericModelForm.save(commit=True)h'jh0hh5hh7}r(h<]rhahh1X&autocomplete_light.contrib.generic_m2mrr}rbh;]h9]h:]h?]rhahXGenericModelForm.saverhj huhANhBhhC]r(h)r}r(h&Xsaveh'jh0hh5hh7}r(h9]h:]h;]h<]h?]uhANhBhhC]rhLXsaverr}r(h&Uh'jubaubj?)r}r(h&Uh'jh0hh5jBh7}r(h9]h:]h;]h<]h?]uhANhBhhC]rjE)r}r(h&X commit=Trueh7}r(h9]h:]h;]h<]h?]uh'jhC]rhLX commit=Truerr}r(h&Uh'jubah5jMubaubh)r}r(h&Uh'jh0Nh5hh7}r(Uexprhh<]h;]h9]h:]h?]uhANhBhhC]rh)r}r(h&Uh7}r(UreftypehUrefdochU refdomainhh<]h;]U refexplicith9]h:]h?]U reftargetX/_modules/autocomplete_light/contrib/generic_m2mUrefidjuh'jhC]rh)r}r(h&Uh7}r(h9]h:]rhah;]h<]h?]uh'jhC]rhLX[source]rr}r(h&Uh'jubah5hubah5hubaubeubh)r}r(h&Uh'jh0hh5hh7}r(h9]h:]h;]h<]h?]uhANhBhhC]r(hP)r}r(h&XMSorry guys, but we have to force commit=True and call save_m2m() right after.rh'jh0jh5hTh7}r(h9]h:]h;]h<]h?]uhAKhBhhC]rhLXMSorry guys, but we have to force commit=True and call save_m2m() right after.rr}r(h&jh'jubaubhP)r}r(h&XThe reason for that is that Django 1.4 kind of left over cases where we wanted to override save_m2m: it enforces its own, which does not care of generic_m2m of course.rh'jh0jh5hTh7}r(h9]h:]h;]h<]h?]uhAKhBhhC]rhLXThe reason for that is that Django 1.4 kind of left over cases where we wanted to override save_m2m: it enforces its own, which does not care of generic_m2m of course.rr}r(h&jh'jubaubeubeubh)r}r(h&Uh'jYh0X/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/autocomplete_light/contrib/generic_m2m.py:docstring of autocomplete_light.contrib.generic_m2m.GenericModelForm.save_m2mrh5hh7}r(h<]h;]h9]h:]h?]Uentries]r(hXKsave_m2m() (autocomplete_light.contrib.generic_m2m.GenericModelForm method)hUtrauhANhBhhC]ubh)r}r(h&Uh'jYh0jh5hh7}r(hhXpyh<]h;]h9]h:]h?]hXmethodrhjuhANhBhhC]r(h)r}r(h&XGenericModelForm.save_m2m()rh'jh0hh5hh7}r(h<]rhahh1X&autocomplete_light.contrib.generic_m2mrr}rbh;]h9]h:]h?]rhahXGenericModelForm.save_m2mrhj huhANhBhhC]r (h)r }r (h&Xsave_m2mh'jh0hh5hh7}r (h9]h:]h;]h<]h?]uhANhBhhC]r hLXsave_m2mrr}r(h&Uh'j ubaubj?)r}r(h&Uh'jh0hh5jBh7}r(h9]h:]h;]h<]h?]uhANhBhhC]ubh)r}r(h&Uh'jh0Nh5hh7}r(Uexprhh<]h;]h9]h:]h?]uhANhBhhC]rh)r}r(h&Uh7}r(UreftypehUrefdochU refdomainhh<]h;]U refexplicith9]h:]h?]U reftargetX/_modules/autocomplete_light/contrib/generic_m2mUrefidjuh'jhC]rh)r}r(h&Uh7}r(h9]h:]rhah;]h<]h?]uh'jhC]r hLX[source]r!r"}r#(h&Uh'jubah5hubah5hubaubeubh)r$}r%(h&Uh'jh0hh5hh7}r&(h9]h:]h;]h<]h?]uhANhBhhC]r'hP)r(}r)(h&X$Save selected generic m2m relations.r*h'j$h0jh5hTh7}r+(h9]h:]h;]h<]h?]uhAKhBhhC]r,hLX$Save selected generic m2m relations.r-r.}r/(h&j*h'j(ubaubaubeubeubeubeubeubeubh0h3j}r0hjsh5h6h7}r1(h9]h:]h;]h<]r2(Ugenericforeignkeyfieldr3jeh?]r4(hheuhAKhBhj}r5jjshC]r6(hE)r7}r8(h&XGenericForeignKeyFieldr9h'h,h0h3h5hIh7}r:(h9]h:]h;]h<]h?]uhAKhBhhC]r;hLXGenericForeignKeyFieldr<r=}r>(h&j9h'j7ubaubh)jeubh0h3h5h6h7}r?(h9]r@hmah:]h;]h<]rAUid1rBah?]uhAKhBhhC]rC(hE)rD}rE(h&XExamplerFh'h)h0h3h5hIh7}rG(h9]h:]h;]h<]h?]uhAKhBhhC]rHhLXExamplerIrJ}rK(h&jFh'jDubaubhy)rL}rM(h&Ximport autocomplete_light from models import TaggedItem class TaggedItemForm(autocomplete_light.GenericModelForm): content_object = autocomplete_light.GenericForeignKeyField( widget=autocomplete_light.AutocompleteWidget( 'MyGenericChannel', max_items=1)) class Meta: model = TaggedItem widgets = autocomplete_light.get_widgets_dict(TaggedItem) exclude = ( 'content_type', 'object_id', ) h'h)h0h3h5h|h7}rN(h~h1XpythonrOrP}rQbh9]hhh<]h;]UsourceX/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/docs/source/../../test_api_project/project_specific/generic_form_example.pyh:]h?]uhAKhBhhC]rRhLXimport autocomplete_light from models import TaggedItem class TaggedItemForm(autocomplete_light.GenericModelForm): content_object = autocomplete_light.GenericForeignKeyField( widget=autocomplete_light.AutocompleteWidget( 'MyGenericChannel', max_items=1)) class Meta: model = TaggedItem widgets = autocomplete_light.get_widgets_dict(TaggedItem) exclude = ( 'content_type', 'object_id', ) rSrT}rU(h&Uh'jLubaubeubh0h3h5Usystem_messagerVh7}rW(h9]UlevelKh<]h;]rXjBaUsourceh3h:]h?]UlineKUtypeUINFOrYuhAKhBhhC]rZhP)r[}r\(h&Uh7}r](h9]h:]h;]h<]h?]uh'h$hC]r^hLX*Duplicate implicit target name: "example".r_r`}ra(h&Uh'j[ubah5hTubaubh#)rb}rc(h&Uh'jh0h3h5jVh7}rd(h9]UlevelKh<]h;]rejaUsourceh3h:]h?]UlineK!UtypejYuhAK!hBhhC]rfhP)rg}rh(h&Uh7}ri(h9]h:]h;]h<]h?]uh'jbhC]rjhLX&Duplicate implicit target name: "api".rkrl}rm(h&Uh'jgubah5hTubaubh#)rn}ro(h&Uh'jh0h3h5jVh7}rp(h9]UlevelKh<]h;]rqjaUsourceh3h:]h?]UlineK,UtypejYuhAK,hBhhC]rrhP)rs}rt(h&Uh7}ru(h9]h:]h;]h<]h?]uh'jnhC]rvhLX*Duplicate implicit target name: "example".rwrx}ry(h&Uh'jsubah5hTubaubh#)rz}r{(h&Uh'jh0h3h5jVh7}r|(h9]UlevelKh<]h;]r}jaUsourceh3h:]h?]UlineK>UtypejYuhAK>hBhhC]r~hP)r}r(h&Uh7}r(h9]h:]h;]h<]h?]uh'jzhC]rhLX&Duplicate implicit target name: "api".rr}r(h&Uh'jubah5hTubaubeUcurrent_sourcerNU decorationrNUautofootnote_startrKUnameidsr}r(hhhjXhhh Nh jh jh h h h hhhhhh^hhhjhhhhhhhhhhhj3hhhhhh>hhhhhNuhC]rh.ah&UU transformerrNU footnote_refsr}rUrefnamesr}rUsymbol_footnotesr]rUautofootnote_refsr]rUsymbol_footnote_refsr]rU citationsr]rhBhU current_linerNUtransform_messagesr]r(h#)r}r(h&Uh7}r(h9]UlevelKh<]h;]Usourceh3h:]h?]UlineKUtypejYuhC]rhP)r}r(h&Uh7}r(h9]h:]h;]h<]h?]uh'jhC]rhLX0Hyperlink target "generic-fk" is not referenced.rr}r(h&Uh'jubah5hTubah5jVubh#)r}r(h&Uh7}r(h9]UlevelKh<]h;]Usourcehh:]h?]UlineKUtypejYuhC]rhP)r}r(h&Uh7}r(h9]h:]h;]h<]h?]uh'jhC]rhLXGHyperlink target "module-autocomplete_light.generic" is not referenced.rr}r(h&Uh'jubah5hTubah5jVubh#)r}r(h&Uh7}r(h9]UlevelKh<]h;]Usourceh3h:]h?]UlineK&UtypejYuhC]rhP)r}r(h&Uh7}r(h9]h:]h;]h<]h?]uh'jhC]rhLX1Hyperlink target "generic-m2m" is not referenced.rr}r(h&Uh'jubah5hTubah5jVubh#)r}r(h&Uh7}r(h9]UlevelKh<]h;]Usourcehh:]h?]UlineKUtypejYuhC]rhP)r}r(h&Uh7}r(h9]h:]h;]h<]h?]uh'jhC]rhLXSHyperlink target "module-autocomplete_light.contrib.generic_m2m" is not referenced.rr}r(h&Uh'jubah5hTubah5jVubeUreporterrNUid_startrKU autofootnotesr]rU citation_refsr}rUindirect_targetsr]rUsettingsr(cdocutils.frontend Values ror}r(Ufootnote_backlinksrKUrecord_dependenciesrNU rfc_base_urlrUhttp://tools.ietf.org/html/rU tracebackrUpep_referencesrNUstrip_commentsrNU toc_backlinksrUentryrU language_coderUenrU datestamprNU report_levelrKU _destinationrNU halt_levelrKU strip_classesrNhINUerror_encoding_error_handlerrUbackslashreplacerUdebugrNUembed_stylesheetrUoutput_encoding_error_handlerrUstrictrU sectnum_xformrKUdump_transformsrNU docinfo_xformrKUwarning_streamrNUpep_file_url_templaterUpep-%04drUexit_status_levelrKUconfigrNUstrict_visitorrNUcloak_email_addressesrUtrim_footnote_reference_spacerUenvrNUdump_pseudo_xmlrNUexpose_internalsrNUsectsubtitle_xformrU source_linkrNUrfc_referencesrNUoutput_encodingrUutf-8rU source_urlrNUinput_encodingrU utf-8-sigrU_disable_configrNU id_prefixrUU tab_widthrKUerror_encodingrUasciirU_sourcerU/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/docs/source/generic.rstrUgettext_compactrU generatorrNUdump_internalsr NU pep_base_urlr Uhttp://www.python.org/dev/peps/r Usyntax_highlightr Ushortr Uinput_encoding_error_handlerrjUauto_id_prefixrUidrUdoctitle_xformrUstrip_elements_with_classesrNU _config_filesr]Ufile_insertion_enabledrKU raw_enabledrKU dump_settingsrNubUsymbol_footnote_startrKUidsr}r(hhjXjThj)hhjjjjh jh jhj.hjh^hZhjjjjjjjjjjBh)jh,hjlhj_hjuhjPh>h.hjj3h,hjyhjhj)r}r(h&Uh'hh0hh5jh7}r(h9]h<]rhah;]Uismodh:]h?]uhAKhBhhC]ubhjhjj-j)hohiuUsubstitution_namesr}rh5hBh7}r (h9]h<]h;]Usourceh3h:]h?]uU footnotesr!]r"Urefidsr#}r$(j]r%jaj]r&jauub.PK6@zz:django-autocomplete-light-0.8/.doctrees/environment.pickle(csphinx.environment BuildEnvironment qoq}q(Udlfilesqcsphinx.util FilenameUniqDict q)qc__builtin__ set q]RqbUintersphinx_named_inventoryq }q U citieslightq }q (X std:labelq }q(Xgenindexq(Xdjango-cities-lightqX1.8qXChttp://django-cities-light.readthedocs.org/en/latest/genindex.html#XIndextqXremote-channelq(hhXPhttp://django-cities-light.readthedocs.org/en/latest/contrib.html#remote-channelXRemote channelstqXmodindexq(hhXFhttp://django-cities-light.readthedocs.org/en/latest/py-modindex.html#X Module IndextqX double-widgetq(hhXOhttp://django-cities-light.readthedocs.org/en/latest/contrib.html#double-widgetXWidgetstqXsearchq(hhXAhttp://django-cities-light.readthedocs.org/en/latest/search.html#X Search PagetqX basic-channelq(hhXOhttp://django-cities-light.readthedocs.org/en/latest/contrib.html#basic-channelX Basic ChanneltquXpy:classq}q(XFcities_light.contrib.autocomplete_light_widgets.CityAutocompleteWidgetq(hhXhttp://django-cities-light.readthedocs.org/en/latest/contrib.html#cities_light.contrib.autocomplete_light_widgets.CityAutocompleteWidgetX-tq Xcities_light.admin.CountryAdminq!(hhX^http://django-cities-light.readthedocs.org/en/latest/full.html#cities_light.admin.CountryAdminX-tq"XJcities_light.contrib.autocomplete_light_restframework.RemoteCountryChannelq#(hhXhttp://django-cities-light.readthedocs.org/en/latest/contrib.html#cities_light.contrib.autocomplete_light_restframework.RemoteCountryChannelX-tq$Xcities_light.models.Cityq%(hhXWhttp://django-cities-light.readthedocs.org/en/latest/full.html#cities_light.models.CityX-tq&XEcities_light.contrib.autocomplete_light_restframework.ApiChannelMixinq'(hhXhttp://django-cities-light.readthedocs.org/en/latest/contrib.html#cities_light.contrib.autocomplete_light_restframework.ApiChannelMixinX-tq(Xcities_light.admin.CityAdminq)(hhX[http://django-cities-light.readthedocs.org/en/latest/full.html#cities_light.admin.CityAdminX-tq*X7cities_light.contrib.ajax_selects_lookups.CountryLookupq+(hhXyhttp://django-cities-light.readthedocs.org/en/latest/contrib.html#cities_light.contrib.ajax_selects_lookups.CountryLookupX-tq,X4cities_light.contrib.ajax_selects_lookups.CityLookupq-(hhXvhttp://django-cities-light.readthedocs.org/en/latest/contrib.html#cities_light.contrib.ajax_selects_lookups.CityLookupX-tq.XAcities_light.contrib.autocomplete_light_channels.CityChannelMixinq/(hhXhttp://django-cities-light.readthedocs.org/en/latest/contrib.html#cities_light.contrib.autocomplete_light_channels.CityChannelMixinX-tq0XGcities_light.contrib.autocomplete_light_restframework.RemoteCityChannelq1(hhXhttp://django-cities-light.readthedocs.org/en/latest/contrib.html#cities_light.contrib.autocomplete_light_restframework.RemoteCityChannelX-tq2Xcities_light.models.Countryq3(hhXZhttp://django-cities-light.readthedocs.org/en/latest/full.html#cities_light.models.CountryX-tq4X?cities_light.contrib.ajax_selects_lookups.StandardLookupChannelq5(hhXhttp://django-cities-light.readthedocs.org/en/latest/contrib.html#cities_light.contrib.ajax_selects_lookups.StandardLookupChannelX-tq6X<cities_light.contrib.autocomplete_light_channels.CityChannelq7(hhX~http://django-cities-light.readthedocs.org/en/latest/contrib.html#cities_light.contrib.autocomplete_light_channels.CityChannelX-tq8uX py:exceptionq9}q:X$cities_light.exceptions.InvalidItemsq;(hhXghttp://django-cities-light.readthedocs.org/en/latest/database.html#cities_light.exceptions.InvalidItemsX-tq(X=cities_light.contrib.ajax_selects_lookups.CountryLookup.modelq?(hhXhttp://django-cities-light.readthedocs.org/en/latest/contrib.html#cities_light.contrib.ajax_selects_lookups.CountryLookup.modelX-tq@X:cities_light.contrib.ajax_selects_lookups.CityLookup.modelqA(hhX|http://django-cities-light.readthedocs.org/en/latest/contrib.html#cities_light.contrib.ajax_selects_lookups.CityLookup.modelX-tqBuX py:moduleqC}qD(X"cities_light.contrib.restframeworkqE(hhXdhttp://django-cities-light.readthedocs.org/en/latest/contrib.html#cities_light.contrib.restframeworkX-tqFX)cities_light.contrib.ajax_selects_lookupsqG(hhXkhttp://django-cities-light.readthedocs.org/en/latest/contrib.html#cities_light.contrib.ajax_selects_lookupsX-tqHXcities_light.signalsqI(hhXWhttp://django-cities-light.readthedocs.org/en/latest/database.html#cities_light.signalsX-tqJXcities_light.exceptionsqK(hhXZhttp://django-cities-light.readthedocs.org/en/latest/database.html#cities_light.exceptionsX-tqLX/cities_light.contrib.autocomplete_light_widgetsqM(hhXqhttp://django-cities-light.readthedocs.org/en/latest/contrib.html#cities_light.contrib.autocomplete_light_widgetsX-tqNXcities_light.modelsqO(hhXRhttp://django-cities-light.readthedocs.org/en/latest/full.html#cities_light.modelsX-tqPXcities_light.settingsqQ(hhXThttp://django-cities-light.readthedocs.org/en/latest/full.html#cities_light.settingsX-tqRXcities_light.adminqS(hhXQhttp://django-cities-light.readthedocs.org/en/latest/full.html#cities_light.adminX-tqTX5cities_light.contrib.autocomplete_light_restframeworkqU(hhXwhttp://django-cities-light.readthedocs.org/en/latest/contrib.html#cities_light.contrib.autocomplete_light_restframeworkX-tqVX0cities_light.contrib.autocomplete_light_channelsqW(hhXrhttp://django-cities-light.readthedocs.org/en/latest/contrib.html#cities_light.contrib.autocomplete_light_channelsX-tqXuX py:methodqY}qZ(XZcities_light.contrib.autocomplete_light_widgets.CityAutocompleteWidget.value_from_datadictq[(hhXhttp://django-cities-light.readthedocs.org/en/latest/contrib.html#cities_light.contrib.autocomplete_light_widgets.CityAutocompleteWidget.value_from_datadictX-tq\XQcities_light.contrib.autocomplete_light_widgets.CityAutocompleteWidget.decompressq](hhXhttp://django-cities-light.readthedocs.org/en/latest/contrib.html#cities_light.contrib.autocomplete_light_widgets.CityAutocompleteWidget.decompressX-tq^XScities_light.contrib.ajax_selects_lookups.StandardLookupChannel.format_item_displayq_(hhXhttp://django-cities-light.readthedocs.org/en/latest/contrib.html#cities_light.contrib.ajax_selects_lookups.StandardLookupChannel.format_item_displayX-tq`XLcities_light.contrib.ajax_selects_lookups.StandardLookupChannel.format_matchqa(hhXhttp://django-cities-light.readthedocs.org/en/latest/contrib.html#cities_light.contrib.ajax_selects_lookups.StandardLookupChannel.format_matchX-tqbX?cities_light.contrib.ajax_selects_lookups.CityLookup.get_resultqc(hhXhttp://django-cities-light.readthedocs.org/en/latest/contrib.html#cities_light.contrib.ajax_selects_lookups.CityLookup.get_resultX-tqdXZcities_light.contrib.autocomplete_light_restframework.ApiChannelMixin.model_for_source_urlqe(hhXhttp://django-cities-light.readthedocs.org/en/latest/contrib.html#cities_light.contrib.autocomplete_light_restframework.ApiChannelMixin.model_for_source_urlX-tqfX[cities_light.contrib.autocomplete_light_restframework.RemoteCityChannel.get_source_url_dataqg(hhXhttp://django-cities-light.readthedocs.org/en/latest/contrib.html#cities_light.contrib.autocomplete_light_restframework.RemoteCityChannel.get_source_url_dataX-tqhXNcities_light.contrib.autocomplete_light_channels.CityChannelMixin.query_filterqi(hhXhttp://django-cities-light.readthedocs.org/en/latest/contrib.html#cities_light.contrib.autocomplete_light_channels.CityChannelMixin.query_filterX-tqjuusUappqkNU _warnfuncqlNUtitlesqm}qn(Uindexqocdocutils.nodes title qp)qq}qr(U rawsourceqsUU attributesqt}qu(Udupnamesqv]Uclassesqw]Ubackrefsqx]Uidsqy]Unamesqz]uUchildrenq{]q|cdocutils.nodes Text q}X5Welcome to django-autocomplete-light's documentation!q~q}q(hsX5Welcome to django-autocomplete-light's documentation!qUparentqhqubaUtagnameqUtitlequbUremoteqhp)q}q(hsUht}q(hv]hw]hx]hy]hz]uh{]qh}X#Proposing results from a remote APIqq}q(hsX#Proposing results from a remote APIqhhubahhubUdjango13qhp)q}q(hsUht}q(hv]hw]hx]hy]hz]uh{]qh}XDjango 1.3 support workaroundsqq}q(hsXDjango 1.3 support workaroundsqhhubahhubUgenericqhp)q}q(hsUht}q(hv]hw]hx]hy]hz]uh{]qh}XGenericForeignKey supportqq}q(hsXGenericForeignKey supportqhhubahhubUdemoqhp)q}q(hsUht}q(hv]hw]hx]hy]hz]uh{]qh}Xdjango-autocomplete-light demoqq}q(hsXdjango-autocomplete-light demoqhhubahhubUformsqhp)q}q(hsUht}q(hv]hw]hx]hy]hz]uh{]qh}XIntegration with formsqq}q(hsXIntegration with formsqhhubahhubUquickqhp)q}q(hsUht}q(hv]hw]hx]hy]hz]uh{]qh}X Quick startqq}q(hsX Quick startqhhubahhubU_admin_templateqhp)q}q(hsUht}q(hv]hw]hx]hy]hz]uh{]qh}X qq}q(hsUhhubahhubU navigationqhp)q}q(hsUht}q(hv]hw]hx]hy]hz]uh{]qh}X'Making a global navigation autocompleteqȅq}q(hsX'Making a global navigation autocompleteqhhubahhubuU domaindataq}q(Ustdq}q(UversionqKU anonlabelsq}q(X templatesqhU templatesqԆXjavascript-funqhUjavascript-funqֆUgenindexqhUX quick-adminqhU quick-adminqنX channel-viewqhU channel-viewqۆUmodindexqU py-modindexUXwidgetqhUwidgetqކXregistry-referenceqhUregistry-referenceqXchannel-referenceqhUchannel-referenceqUsearchqUsearchUXjavascript-setuphUjavascript-setupX generic-fkqhU generic-fkqXremote-exampleqhUremote-exampleqX generic-m2mqhU generic-m2mqXremoteqhUremoteqXdebuggerqhoUdebuggerquUlabelsq}q(hhhXJavascript funhhhXWidget in actionhhhXQuick admin integrationhhhXJavascript eventshU py-modindexUcsphinx.locale _TranslationProxy qcsphinx.locale mygettext qU Module IndexqqhhqbhhUhhU Search PageqqhhqbhhhXRegistryhhhXChannels basicshhUhhUIndexqqhhqbhhhXGenericForeignKeyFieldhhhXExamplehhhXGenericManyToManyhhhX#Proposing results from a remote APIhhohXWhen things go wronguU progoptionsq}qUobjectsq}quUc}q(h}rhKuUpyr}r(h}r(X5autocomplete_light.channel.generic.GenericChannelBaserhXclassrX+autocomplete_light.registry.ChannelRegistryrhXclassrX$autocomplete_light.views.ChannelViewrhXclassr X!autocomplete_light.channel.remoter hUmoduler X;autocomplete_light.channel.base.ChannelBase.result_as_valuer hXmethodr X4autocomplete_light.registry.ChannelRegistry.registerrhXmethodrXHautocomplete_light.channel.remote.RemoteChannelBase.model_for_source_urlrhXmethodrX)autocomplete_light.forms.get_widgets_dictrhXfunctionrX8autocomplete_light.channel.base.ChannelBase.get_querysetrhXmethodrX?autocomplete_light.generic.GenericForeignKeyField.prepare_valuerhXmethodrX)autocomplete_light.views.ChannelView.postrhXmethodrX(autocomplete_light.registry.autodiscoverrhXfunctionrX7autocomplete_light.contrib.generic_m2m.GenericModelFormrhXclassrX?autocomplete_light.channel.generic.GenericChannelBase.are_validrhXmethodrXCautocomplete_light.channel.generic.GenericChannelBase.order_resultsr hXmethodr!X9autocomplete_light.channel.base.ChannelBase.values_filterr"hXmethodr#X8autocomplete_light.contrib.generic_m2m.GenericManyToManyr$hXclassr%X7autocomplete_light.channel.base.ChannelBase.get_resultsr&hXmethodr'XEautocomplete_light.channel.generic.GenericChannelBase.result_as_valuer(hXmethodr)X*autocomplete_light.forms.modelform_factoryr*hXfunctionr+X=autocomplete_light.registry.ChannelRegistry.channel_for_modelr,hXmethodr-X3autocomplete_light.channel.base.ChannelBase.as_dictr.hXmethodr/XBautocomplete_light.channel.remote.RemoteChannelBase.get_source_urlr0hXmethodr1X(autocomplete_light.views.ChannelView.getr2hXmethodr3XCautocomplete_light.channel.remote.RemoteChannelBase.result_as_valuer4hXmethodr5XBautocomplete_light.channel.remote.RemoteChannelBase.result_as_dictr6hXmethodr7X-autocomplete_light.widgets.AutocompleteWidgetr8hXclassr9X<autocomplete_light.channel.base.ChannelBase.get_absolute_urlr:hXmethodr;XCautocomplete_light.channel.generic.GenericChannelBase.values_filterr<hXmethodr=XAautocomplete_light.channel.generic.GenericChannelBase.get_resultsr>hXmethodr?X9autocomplete_light.channel.remote.RemoteChannelBase.fetchr@hXmethodrAX4autocomplete_light.widgets.AutocompleteWidget.renderrBhXmethodrCX5autocomplete_light.channel.base.ChannelBase.are_validrDhXmethodrEX;autocomplete_light.generic.GenericForeignKeyField.to_pythonrFhXmethodrGX@autocomplete_light.channel.remote.RemoteChannelBase.fetch_resultrHhXmethodrIXAautocomplete_light.widgets.AutocompleteWidget.value_from_datadictrJhXmethodrKX1autocomplete_light.generic.GenericForeignKeyFieldrLhXclassrMXautocomplete_light.widgetsrNhj X8autocomplete_light.channel.remote.RemoteChannelBase.postrOhXmethodrPX:autocomplete_light.channel.base.ChannelBase.result_as_htmlrQhXmethodrRX+autocomplete_light.channel.base.ChannelBaserShXclassrTXautocomplete_light.genericrUhj XBautocomplete_light.registry.ChannelRegistry.register_model_channelrVhXmethodrWXJautocomplete_light.contrib.generic_m2m.GenericModelForm.generic_m2m_fieldsrXhXmethodrYX@autocomplete_light.contrib.generic_m2m.GenericModelForm.save_m2mrZhXmethodr[X3autocomplete_light.channel.remote.RemoteChannelBaser\hXclassr]XGautocomplete_light.channel.remote.RemoteChannelBase.get_source_url_datar^hXmethodr_X6autocomplete_light.registry.ChannelRegistry.unregisterr`hXmethodraXFautocomplete_light.channel.remote.RemoteChannelBase.get_remote_resultsrbhXmethodrcX&autocomplete_light.contrib.generic_m2mrdhj X$autocomplete_light.registry.registerrehXfunctionrfX8autocomplete_light.channel.base.ChannelBase.query_filterrghXmethodrhX<autocomplete_light.channel.base.ChannelBase.init_for_requestrihXmethodrjX0autocomplete_light.generic.GenericModelForm.saverkhXmethodrlXautocomplete_light.registryrmhj X<autocomplete_light.contrib.generic_m2m.GenericModelForm.savernhXmethodroX?autocomplete_light.channel.base.ChannelBase.render_autocompleterphXmethodrqXautocomplete_light.channel.baserrhj X+autocomplete_light.generic.GenericModelFormrshXclassrtX?autocomplete_light.channel.remote.RemoteChannelBase.get_resultsruhXmethodrvX<autocomplete_light.registry.ChannelRegistry.register_channelrwhXmethodrxX"autocomplete_light.channel.genericryhj Xautocomplete_light.formsrzhj X9autocomplete_light.channel.base.ChannelBase.order_resultsr{hXmethodr|uUmodulesr}}r~(j (hUUtjd(hUUtjN(hUUtjm(hUUtjr(hUUtjU(hUUtjy(hUUtjz(hUUtuhKuUjsr}r(h}rhKuUrstr}r(h}rhKuUcppr}r(h}rhKuuU glob_toctreesrh]RrU reread_alwaysrh]RrU doctreedirrU/home/docs/sites/readthedocs.org/checkouts/readthedocs.org/user_builds/django-autocomplete-light/checkouts/0.8/docs/source/_build/html/.doctreesrUversioning_conditionrU citationsr}hK)Uintersphinx_inventoryr}r(h }r(hhhhhhhhhhhhuh}r(h!h"h#h$h%h&h'h(hh h+h,h-h.h)h*h/h0h1h2h3h4h5h6h7h8uh9}rh;h In this template, my option selector is simply 'li:has(a)'. So every tag that is in an li with an a tag will be considered as a valid option by the autocomplete. As for the url, it looks like this:: url( r'^autocomplete/$', views.autocomplete, name='project_specific_autocomplete', ), So, nothing really special here ... and that's what I like with this autocomplete. You can use the presentation you want as long as you have a selector for your options. Create the input ---------------- Nothing magical here, just add an HTML input to your base template, for example:: Of course, if you have haystack or any kind of search, you could use it as well, it doesn't matter::
    {{ search_form.q }}
    Loading the script ------------------ If you haven't done it already, load jQuery and the yourlabs_autocomplete extension, for example:: Script usage ------------ The last thing we need to do is to connect the autocomplete script with the input and the autocomplete view. Something like this would work:: There are other options. If these don't work very well for you, you should read autocomplete.js. It's not a fat bloated script like jQueryUi autocomplete with tons of dependencies, so it shouldn't be that hard to figure it out. The other thing you want to do, is bind an event to the event yourlabs_autocomplete.selectOption, that is fired when the user selects an option by clicking on it for example:: That's all folks ! Enjoy your fine global navigation autocomplete. Personnaly I think there should be one in the header of every project, it is just **so** convenient for the user. And if nicely designed, it is very 'web 2.0' whatever it means hahah. PKw6@2__2django-autocomplete-light-0.8/_sources/generic.txtGenericForeignKey support ========================= Generic foreign keys are supported since 0.4. GenericChannelBase ------------------ Example ~~~~~~~ .. literalinclude:: ../../test_api_project/project_specific/generic_channel_example.py :language: python API ~~~ .. automodule:: autocomplete_light.channel.generic :members: .. _generic-fk: GenericForeignKeyField ---------------------- Example ~~~~~~~ .. literalinclude:: ../../test_api_project/project_specific/generic_form_example.py :language: python API ~~~ .. automodule:: autocomplete_light.generic :members: .. _generic-m2m: GenericManyToMany ----------------- Example ~~~~~~~ Example model with ``related``: .. literalinclude:: ../../test_project/generic_m2m_example/models.py :language: python Example ``generic_m2m.GenericModelForm`` usage: .. literalinclude:: ../../test_project/generic_m2m_example/forms.py :language: python Example ``ModelAdmin``: .. literalinclude:: ../../test_project/generic_m2m_example/admin.py :language: python API ~~~ .. automodule:: autocomplete_light.contrib.generic_m2m :members: PKw6@>  0django-autocomplete-light-0.8/_sources/quick.txtQuick start =========== The purpose of this documentation is to get you started as fast as possible, because your time matters and you probably have other things to worry about. Quick install ------------- Install the package:: pip install django-autocomplete-light # or the development version pip install -e git+git://github.com/yourlabs/django-autocomplete-light.git#egg=django-autocomplete-light Add to INSTALLED_APPS: 'autocomplete_light' Add to urls:: url(r'autocomplete/', include('autocomplete_light.urls')), Add before admin.autodiscover():: import autocomplete_light autocomplete_light.autodiscover() At this point, we're going to assume that you have `django.contrib.staticfiles `_ working. This means that `static files are automatically served with runserver `_, and that you have to run `collectstatic when using another server `_ (fastcgi, uwsgi, and whatnot). If you don't use django.contrib.staticfiles, then you're on your own to manage staticfiles. .. _javascript-setup: This is an example of how you could load the javascript:: {% include 'autocomplete_light/static.html' %} .. _quick-admin: Quick admin integration ----------------------- .. include:: _admin_template.rst Create ``yourapp/autocomplete_light_registry.py``, assuming "Author" has a "full_name" CharField:: import autocomplete_light from models import Author autocomplete_light.register(Author, search_field='full_name') See more about the channel registry in :ref:`registry-reference`. But still, the `default implementation of query_filter() `_ is pretty trivial, you might want to customize how it will filter the queryset. See more about customizing channels in :ref:`channel-reference`. Anyway, finish by setting ``BookAdmin.form`` in yourapp/admin.py:: from django.contrib import admin import autocomplete_light from models import Book class BookAdmin(admin.ModelAdmin): # use an autocomplete for Author form = autocomplete_light.modelform_factory(Book) admin.site.register(Book, BookAdmin) Quick form integration ---------------------- AutocompleteWidget is usable on ModelChoiceField and ModelMultipleChoiceField. .. autoclass:: autocomplete_light.widgets.AutocompleteWidget :noindex: PKw6@3django-autocomplete-light-0.8/_sources/django13.txtDjango 1.3 support workarounds ============================== The app is was developed for Django 1.4. However, there are workarounds to get it to work with Django 1.3 too. This document attemps to provide an exhaustive list of notes that should be taken in account when using the app with django-autocomplete-light. modelform_factory ----------------- The provided autocomplete_light.modelform_factory relies on Django 1.4's modelform_factory that accepts a 'widgets' dict. Django 1.3 does not allow such an argument. You may however define your form as such:: class AuthorForm(forms.ModelForm): class Meta: model = Author widgets = autocomplete_light.get_widgets_dict(Author) PKw6@q :django-autocomplete-light-0.8/_sources/_admin_template.txtFor AutocompleteWidget to be enabled in the admin, you should create your own ``admin/base_site.html`` template as demonstrated in ``test_project/templates/admin/base_site.html``: .. literalinclude:: ../../test_project/templates/admin/base_site.html :language: html PK6@}E{'{'1django-autocomplete-light-0.8/_modules/index.html Overview: module code — django-autocomplete-light 0.7 documentation

    Project Versions

    PK6@DDDdjango-autocomplete-light-0.8/_modules/autocomplete_light/forms.html autocomplete_light.forms — django-autocomplete-light 0.7 documentation

    Source code for autocomplete_light.forms

    """
    A couple of helper functions to help enabling AutocompleteWidget in ModelForms.
    """
    from django.forms.models import modelform_factory as django_modelform_factory
    from django.db.models import ForeignKey, OneToOneField
    
    from .widgets import AutocompleteWidget
    from .registry import registry
    
    __all__ = ['get_widgets_dict', 'modelform_factory']
    
    
    
    [docs]def get_widgets_dict(model, autocomplete_exclude=None): """ Return a dict of field_name: widget_instance for model that is compatible with Django. autocomplete_exclude the list of model field names to ignore Inspect the model's field and many to many fields, calls registry.channel_for_model to get the channel for the related model. If a channel is returned, then an AutocompleteWidget will be spawned using this channel. The dict is usable by ModelForm.Meta.widgets. In django 1.4, with modelform_factory too. """ if autocomplete_exclude is None: autocomplete_exclude = [] widgets = {} for field in model._meta.fields: if field.name in autocomplete_exclude: continue if not isinstance(field, (ForeignKey, OneToOneField)): continue channel = registry.channel_for_model(field.rel.to) if not channel: continue widgets[field.name] = AutocompleteWidget(channel_name=channel.__name__, max_items=1) for field in model._meta.many_to_many: if field.name in autocomplete_exclude: continue channel = registry.channel_for_model(field.rel.to) if not channel: continue widgets[field.name] = AutocompleteWidget(channel_name=channel.__name__) return widgets
    [docs]def modelform_factory(model, autocomplete_exclude=None, **kwargs): """ Wraps around Django's django_modelform_factory, using get_widgets_dict. Basically, it will use the dict returned by get_widgets_dict in order and pass it to django's modelform_factory, and return the resulting modelform. """ widgets = get_widgets_dict(model, autocomplete_exclude=autocomplete_exclude) widgets.update(kwargs.pop('widgets', {})) kwargs['widgets'] = widgets return django_modelform_factory(model, **kwargs)

    Project Versions

    PK6@A4r4rFdjango-autocomplete-light-0.8/_modules/autocomplete_light/widgets.html autocomplete_light.widgets — django-autocomplete-light 0.7 documentation

    Source code for autocomplete_light.widgets

    from django.utils import simplejson
    from django import forms
    from django.forms.util import flatatt
    from django.utils import safestring
    from django.template.loader import render_to_string
    
    __all__ = ['AutocompleteWidget']
    
    
    
    [docs]class AutocompleteWidget(forms.SelectMultiple): """ Widget suitable for ModelChoiceField and ModelMultipleChoiceField. Example usage:: from django import forms import autocomplete_light from models import Author class AuthorsForm(forms.Form): lead_author = forms.ModelChoiceField(Author.objects.all(), widget= autocomplete_light.AutocompleteWidget( 'AuthorChannel', max_items=1)) contributors = forms.ModelMultipleChoiceField(Author.objects.all(), widget=autocomplete_light.AutocompleteWidget('AuthorChannel')) """ payload = {} def __init__(self, channel_name, *args, **kwargs): """ AutocompleteWidget constructor decorates SelectMultiple constructor Arguments: channel_name -- the name of the channel that this widget should use. Keyword arguments are passed to javascript via data attributes of the autocomplete wrapper element: max_items The number of items that this autocomplete allows. If set to 0, then it allows any number of selected items like a multiple select, well suited for ManyToMany relations or any kind of ModelMultipleChoiceField. If set to 3 for example, then it will only allow 3 selected items. It should be set to 1 if the widget is for a ModelChoiceField or ForeignKey, in that case it would be like a normal select. Default is 0. min_characters The minimum number of characters before the autocomplete box shows up. If set to 2 for example, then the autocomplete box will show up when the input receives the second character, for example 'ae'. If set to 0, then the autocomplete box will show up as soon as the input is focused, even if it's empty, behaving like a normal select. Default is 0. bootstrap The name of the bootstrap kind. By default, deck.js will only initialize decks for wrappers that have data-bootstrap="normal". If you want to implement your own bootstrapping logic in javascript, then you set bootstrap to anything that is not "normal". By default, its value is copied from channel.bootstrap. placeholder The initial value of the autocomplete input field. It can be something like 'type your search here'. By default, it is copied from channel.placeholder. payload A dict of data that will be exported to JSON, and parsed into the Deck instance in javascript. It allows to pass variables from Python to Javascript. """ self.channel_name = channel_name from autocomplete_light import registry self.channel = registry[channel_name]() self.payload.update(kwargs.pop('payload', {})) self.max_items = kwargs.pop('max_items', 0) self.min_characters = kwargs.pop('min_characters', 0) self.bootstrap = kwargs.pop('bootstrap', self.channel.bootstrap) self.placeholder = kwargs.pop('placeholder', self.channel.placeholder) super(AutocompleteWidget, self).__init__(*args, **kwargs)
    [docs] def render(self, name, value, attrs=None): """ Render the autocomplete widget. It will try two templates, like django admin: - autocomplete_light/channelname/widget.html - autocomplete_light/widget.html Note that it will not pass 'value' to the template, because 'value' might be a list of model ids in the case of ModelMultipleChoiceField, or a model id in the case of ModelChoiceField. To keep things simple, it will just pass a list, 'values', to the template context. """ final_attrs = self.build_attrs(attrs) self.html_id = final_attrs.pop('id', name) if value and not isinstance(value, (list, tuple)): values = [value] else: values = value if values and not self.channel.are_valid(values): raise forms.ValidationError('%s cannot validate %s' % ( self.channel_name, values)) self.payload.update(self.as_dict()) self.payload['channel'] = self.channel.as_dict() channel_name = self.channel_name.lower() return safestring.mark_safe(render_to_string([ 'autocomplete_light/%s/widget.html' % channel_name, 'autocomplete_light/widget.html', ], { 'widget': self, 'name': name, 'values': values, 'channel': self.channel, 'results': self.channel.get_results(values or []), 'json_payload': safestring.mark_safe(simplejson.dumps( self.payload)), 'extra_attrs': safestring.mark_safe(flatatt(final_attrs)), } ))
    def as_dict(self): return { 'max_items': self.max_items, 'min_characters': self.min_characters, 'bootstrap': self.bootstrap, # cast to unicode as it might be a gettext proxy 'placeholder': unicode(self.placeholder), } # we might want to split up in two widgets for that ... is it necessary ? # apparently not yet, but maybe at next django release
    [docs] def value_from_datadict(self, data, files, name): """Route to Select if max_items is 1, else route to SelectMultiple""" if self.max_items == 1: return forms.Select.value_from_datadict(self, data, files, name) else: return forms.SelectMultiple.value_from_datadict(self, data, files, name)
    def _has_changed(self, initial, data): """Route to Select if max_items is 1, else route to SelectMultiple""" if self.max_items == 1: return forms.Select._has_changed(self, initial, data) else: return forms.SelectMultiple._has_changed(self, initial, data)

    Project Versions

    PK6@YYFdjango-autocomplete-light-0.8/_modules/autocomplete_light/generic.html autocomplete_light.generic — django-autocomplete-light 0.7 documentation

    Source code for autocomplete_light.generic

    from django import forms
    from django.db import models
    from django.forms import fields
    from django.contrib.contenttypes.generic import GenericForeignKey
    from django.contrib.contenttypes.models import ContentType
    
    __all__ = ('GenericModelForm', 'GenericForeignKeyField')
    
    
    
    [docs]class GenericModelForm(forms.ModelForm): """ This simple subclass of ModelForm fixes a couple of issues with django's ModelForm. - treat virtual fields like GenericForeignKey as normal fields, Django should already do that but it doesn't, - when setting a GenericForeignKey value, also set the object id and content type id fields, again Django could probably afford to do that. """ def __init__(self, *args, **kwargs): """ What ModelForm does, but also add virtual field values to self.initial. """ super(GenericModelForm, self).__init__(*args, **kwargs) # do what model_to_dict doesn't for field in self._meta.model._meta.virtual_fields: self.initial[field.name] = getattr(self.instance, field.name, None) def _post_clean(self): """ What ModelForm does, but also set virtual field values from cleaned_data. """ super(GenericModelForm, self)._post_clean() # take care of virtual fields since django doesn't for field in self._meta.model._meta.virtual_fields: value = self.cleaned_data.get(field.name, None) if value: setattr(self.instance, field.name, value)
    [docs] def save(self, commit=True): """ What ModelForm does, but also set GFK.ct_field and GFK.fk_field if such a virtual field has a value. This should probably be done in the GFK field itself, but it's here for convenience until Django fixes that. """ for field in self._meta.model._meta.virtual_fields: if isinstance(field, GenericForeignKey): value = self.cleaned_data.get(field.name, None) if not value: continue setattr(self.instance, field.ct_field, ContentType.objects.get_for_model(value)) setattr(self.instance, field.fk_field, value.pk) return super(GenericModelForm, self).save(commit)
    [docs]class GenericForeignKeyField(fields.Field): """ Simple form field that converts strings to models. """
    [docs] def prepare_value(self, value): """ Given a model instance as value, with content type id of 3 and pk of 5, return such a string '3-5'. """ if isinstance(value, (str, unicode)): # Apparently there's a bug in django, that causes a python value to # be passed here. This ONLY happens when in an inline .... return value elif isinstance(value, models.Model): return '%s-%s' % (ContentType.objects.get_for_model(value).pk, value.pk)
    [docs] def to_python(self, value): """ Given a string like '3-5', return the model of content type id 3 and pk 5. """ if not value: return value content_type_id, object_id = value.split('-') model = ContentType.objects.get_for_id(content_type_id).model_class() return model.objects.get(pk=object_id)

    Project Versions

    PK6@P ssGdjango-autocomplete-light-0.8/_modules/autocomplete_light/registry.html autocomplete_light.registry — django-autocomplete-light 0.7 documentation

    Source code for autocomplete_light.registry

    """
    The registry module provides tools to maintain a registry of channels.
    
    The first thing that should happen when django starts is registration of
    channels. It should happen first, because channels are required for
    autocomplete widgets. And autocomplete widgets are required for forms. And
    forms are required for ModelAdmin.
    
    It looks like this:
    
    - in ``yourapp/autocomplete_light_registry.py``, register your channels with
      ``autocomplete_light.register()``,
    - in ``urls.py``, do ``autocomplete_light.autodiscover()`` **before**
      ``admin.autodiscover()``.
    
    ChannelRegistry
        Subclass of Python's dict type with registration/unregistration methods.
    
    registry
        Instance of ChannelRegistry.
    
    register
        Proxy registry.register.
    
    autodiscover
        Find channels and fill registry.
    """
    
    from django.db import models
    
    from .channel import ChannelBase
    
    __all__ = ('ChannelRegistry', 'registry', 'register', 'autodiscover')
    
    
    
    [docs]class ChannelRegistry(dict): """ Dict with some shortcuts to handle a registry of channels. """ def __init__(self): self._models = {}
    [docs] def channel_for_model(self, model): """Return the channel class for a given model.""" try: return self._models[model] except KeyError: return
    [docs] def unregister(self, name): """ Unregister a channel. """ channel = self[name] del self[name] if channel.model: del self._models[channel.model]
    [docs] def register(self, *args, **kwargs): """ Proxy registry.register_model_channel() or registry.register_channel() if there is no apparent model for the channel. Example usages:: # Will create and register SomeModelChannel, if SomeChannel.model # is None (which is the case by default): autocomplete_light.register(SomeModel) # Same but using SomeChannel as base: autocomplete_light.register(SomeModel, SomeChannel) # Register a channel without model, ensure that SomeChannel.model # is None (which is the default): autocomplete_light.register(SomeChannel) # As of 0.5, you may also pass attributes*, ie.: autocomplete_light.register(SomeModel, search_field='search_names', result_template='somemodel_result.html') You may pass attributes via kwargs, only if the registry creates a type: - if no channel class is passed, - or if the channel class has no model attribute, - and if the channel classs is not generic """ channel = None model = None for arg in args: if issubclass(arg, models.Model): model = arg elif issubclass(arg, ChannelBase): channel = arg if channel and getattr(channel, 'model'): model = channel.model if model: self.register_model_channel(model, channel, **kwargs) else: self.register_channel(channel)
    [docs] def register_model_channel(self, model, channel=None, channel_name=None, **kwargs): """ Add a model to the registry, optionnaly with a given channel class. model The model class to register. channel The channel class to register the model with, default to ChannelBase. channel_name Register channel under channel_name, default is ModelNameChannel. kwargs Extra attributes to set to the channel class, if created by this method. Three cases are possible: - specify model class and ModelNameChannel will be generated extending ChannelBase, with attribute model=model - specify a model and a channel class that does not have a model attribute, and a ModelNameChannel will be generated, with attribute model=model - specify a channel class with a model attribute, and the channel is directly registered To keep things simple, the name of a channel is it's class name, which is usually generated. In case of conflicts, you may override the default channel name with the channel_name keyword argument. """ kwargs.update({'model': model}) if channel_name is None: channel_name = '%sChannel' % model.__name__ if channel is None: channel = type(channel_name, (ChannelBase,), kwargs) elif channel.model is None: channel = type(channel_name, (channel,), kwargs) self.register_channel(channel) self._models[channel.model] = channel
    [docs] def register_channel(self, channel): """ Register a channel without model, like a generic channel. """ self[channel.__name__] = channel
    def _autodiscover(registry): """See documentation for autodiscover (without the underscore)""" import copy from django.conf import settings from django.utils.importlib import import_module from django.utils.module_loading import module_has_submodule for app in settings.INSTALLED_APPS: mod = import_module(app) # Attempt to import the app's admin module. try: before_import_registry = copy.copy(registry) import_module('%s.autocomplete_light_registry' % app) except: # Reset the model registry to the state before the last import as # this import will have to reoccur on the next request and this # could raise NotRegistered and AlreadyRegistered exceptions # (see #8245). registry = before_import_registry # Decide whether to bubble up this error. If the app just # doesn't have an admin module, we can ignore the error # attempting to import it, otherwise we want it to bubble up. if module_has_submodule(mod, 'autocomplete_light_registry'): raise registry = ChannelRegistry()
    [docs]def autodiscover(): """ Check all apps in INSTALLED_APPS for stuff related to autocomplete_light. For each app, autodiscover imports app.autocomplete_light_registry if available, resulting in execution of register() statements in that module, filling registry. Consider a standard app called 'cities_light' with such a structure:: cities_light/ __init__.py models.py urls.py views.py autocomplete_light_registry.py With such a autocomplete_light_registry.py:: from models import City, Country import autocomplete_light autocomplete_light.register(City) autocomplete_light.register(Country) When autodiscover() imports cities_light.autocomplete_light_registry, both CityChannel and CountryChannel will be registered. For details on how these channel classes are generated, read the documentation of ChannelRegistry.register. """ _autodiscover(registry)
    [docs]def register(*args, **kwargs): """Proxy registry.register""" return registry.register(*args, **kwargs)

    Project Versions

    PK6@99Ddjango-autocomplete-light-0.8/_modules/autocomplete_light/views.html autocomplete_light.views — django-autocomplete-light 0.7 documentation

    Source code for autocomplete_light.views

    from django import http
    from django.views import generic
    
    import autocomplete_light
    
    __all__ = ['ChannelView']
    
    
    
    [docs]class ChannelView(generic.View): """Simple view that routes the request to the appropriate channel."""
    [docs] def get(self, request, *args, **kwargs): """ Return an HttpResponse with the return value of channel.render_autocomplete(). This view is called by the autocomplete script, it is expected to return the rendered autocomplete box contents. To do so, it gets the channel class from the registry, given the url keyword argument channel, that should be the channel name. Then, it instanciates the channel with no argument as usual, and calls channel.init_for_request, passing all arguments it recieved. Finnaly, it makes an HttpResponse with the result of channel.render_autocomplete(). The javascript will use that to fill the autocomplete suggestion box. """ channel_class = autocomplete_light.registry[kwargs['channel']] channel = channel_class() channel.init_for_request(request, *args, **kwargs) return http.HttpResponse(channel.render_autocomplete())
    [docs] def post(self, request, *args, **kwargs): """ Just proxy channel.post(). This is the key to communication between the channel and the widget in javascript. You can use it to create results and such. """ channel_class = autocomplete_light.registry[kwargs['channel']] channel = channel_class() return channel.post(request, *args, **kwargs)

    Project Versions

    PK6@:M4D~D~Kdjango-autocomplete-light-0.8/_modules/autocomplete_light/channel/base.html autocomplete_light.channel.base — django-autocomplete-light 0.7 documentation

    Source code for autocomplete_light.channel.base

    """
    The channel.base module provides a channel class which you can extend to make
    your own channel. It also serves as default channel class.
    """
    
    from django.core import urlresolvers
    from django.template import loader
    from django.utils.translation import ugettext_lazy as _
    
    __all__ = ('ChannelBase',)
    
    
    
    [docs]class ChannelBase(object): """ A basic implementation of a channel, which should fit most use cases. Attributes: model The model class this channel serves. If None, a new class will be created in registry.register, and the model attribute will be set in that subclass. So you probably don't need to worry about it, just know that it's there for you to use. result_template The template to use in result_as_html method, to render a single autocomplete suggestion. By default, it is autocomplete_light/channelname/result.html or autocomplete_light/result.html. autocomplete_template The template to use in render_autocomplete method, to render the autocomplete box. By default, it is autocomplete_light/channelname/autocomplete.html or autocomplete_light/autocomplete.html. search_field The name of the field that the default implementation of query_filter uses. Default is 'name'. limit_results The number of results that this channel should return. For example, if query_filter returns 50 results and that limit_results is 20, then the first 20 of 50 results will be rendered. Default is 20. bootstrap The name of the bootstrap kind. By default, deck.js will only initialize decks for wrappers that have data-bootstrap="normal". If you want to implement your own bootstrapping logic in javascript, then you set bootstrap to anything that is not "normal". Default is 'normal'. placeholder The initial text in the autocomplete text input. """ model = None search_field = 'name' limit_results = 20 bootstrap = 'normal' placeholder = _(u'type some text to search in this autocomplete') result_template = None autocomplete_template = None def __init__(self): """ Set result_template and autocomplete_template if necessary. """ name = self.__class__.__name__.lower() if not self.result_template: self.result_template = [ 'autocomplete_light/%s/result.html' % name, 'autocomplete_light/result.html', ] if not self.autocomplete_template: self.autocomplete_template = [ 'autocomplete_light/%s/autocomplete.html' % name, 'autocomplete_light/autocomplete.html', ] self.request = None
    [docs] def get_absolute_url(self): """ Return the absolute url for this channel, using autocomplete_light_channel url """ return urlresolvers.reverse('autocomplete_light_channel', args=( self.__class__.__name__,))
    [docs] def as_dict(self): """ Return a dict of variables for this channel, it is used by javascript. """ return { 'url': self.get_absolute_url(), 'name': self.__class__.__name__ }
    [docs] def init_for_request(self, request, *args, **kwargs): """ Set self.request, self.args and self.kwargs, useful in query_filter. """ self.request = request self.args = args self.kwargs = kwargs
    [docs] def query_filter(self, results): """ Filter results using the request. By default this will expect results to be a queryset, and will filter it with self.search_field + '__icontains'=self.request['q']. """ q = self.request.GET.get('q', None) if q: kwargs = {"%s__icontains" % self.search_field: q} results = results.filter(**kwargs) return results
    [docs] def values_filter(self, results, values): """ Filter results based on a list of values. By default this will expect values to be an iterable of model ids, and results to be a queryset. Thus, it will return a queryset where pks are in values. """ results = results.filter(pk__in=values) return results
    [docs] def get_queryset(self): """ Return a queryset for the channel model. """ return self.model.objects.all()
    [docs] def get_results(self, values=None): """ Return an iterable of result to display in the autocomplete box. By default, it will: - call self.get_queryset(), - call values_filter() if values is not None, - call query_filter() if self.request is set, - call order_results(), - return a slice from offset 0 to self.limit_results. """ results = self.get_queryset() if values is not None: # used by the widget to prerender existing values results = self.values_filter(results, values) elif self.request: # used by the autocomplete results = self.query_filter(results) return self.order_results(results)[0:self.limit_results]
    [docs] def order_results(self, results): """ Return the result list after ordering. By default, it expects results to be a queryset and order it by search_field. """ return results.order_by(self.search_field).distinct()
    [docs] def are_valid(self, values): """ Return True if the values are valid. By default, expect values to be a list of object ids, return True if all the ids are found in the queryset. """ return self.get_queryset().filter(pk__in=values).count() == len(values)
    [docs] def result_as_html(self, result, extra_context=None): """ Return the html representation of a result for display in the deck and autocomplete box. By default, render result_template with channel and result in the context. """ context = { 'channel': self, 'result': result, 'value': self.result_as_value(result), } context.update(extra_context or {}) return loader.render_to_string(self.result_template, context)
    [docs] def result_as_value(self, result): """ Return the value that should be set to the widget field for a result. By default, return result.pk. """ return result.pk
    [docs] def render_autocomplete(self): """ Render the autocomplete suggestion box. By default, render self.autocomplete_template with the channel in the context. """ return loader.render_to_string(self.autocomplete_template, { 'channel': self, })

    Project Versions

    PK6@x`KNKNNdjango-autocomplete-light-0.8/_modules/autocomplete_light/channel/generic.html autocomplete_light.channel.generic — django-autocomplete-light 0.7 documentation

    Source code for autocomplete_light.channel.generic

    from django.contrib.contenttypes.models import ContentType
    
    from autocomplete_light.generic import GenericForeignKeyField
    from .base import ChannelBase
    
    __all__ = ['GenericChannelBase']
    
    
    
    [docs]class GenericChannelBase(ChannelBase): """ Wraps around multiple querysets, from multiple model classes, rather than just one. This is also interresting as it overrides **all** the default model logic from ChannelBase. Hell, you could even copy it and make your CSVChannelBase, a channel that uses a CSV file as backend. But only if you're really bored or for a milion dollars. """
    [docs] def result_as_value(self, result): """ Rely on GenericForeignKeyField to return a string containing the content type id and object id of the result. Because this channel is made for that field, and to avoid code duplication. """ field = GenericForeignKeyField() return field.prepare_value(result)
    [docs] def order_results(self, results): """ Return results, **without** doing any ordering. In most cases, you would not have to override this method as querysets should be ordered by default, based on model.Meta.ordering. """ return results # can't order because don't know what model type
    [docs] def get_results(self, values=None): """ Return results for each queryset returned by get_querysets(). Note that it limits each queryset's to self.limit_result. If you want a maximum of 12 suggestions and have a total of 4 querysets, then self.limit_results should be set to 3. """ for model, queryset in self.get_querysets().items(): if values is not None: queryset = self.values_filter(queryset, values) elif self.request: queryset = self.query_filter(queryset) for result in self.order_results(queryset)[0:self.limit_results]: yield result
    [docs] def are_valid(self, values): """ Return True if it can find all the models refered by values. """ for value in values: # some nice Q action could be done here content_type_id, object_id = value.split('-') model = ContentType.objects.get_for_id( content_type_id).model_class() if not model.objects.filter(pk=object_id).count(): return False return True
    [docs] def values_filter(self, results, values): """ Filter out any result from results that is not refered to by values. """ ctype = ContentType.objects.get_for_model(results.model).pk ids = [x.split('-')[1] for x in values if int(x.split('-')[0]) == ctype] return results.filter(pk__in=ids)

    Project Versions

    PK6@xԆԆMdjango-autocomplete-light-0.8/_modules/autocomplete_light/channel/remote.html autocomplete_light.channel.remote — django-autocomplete-light 0.7 documentation

    Source code for autocomplete_light.channel.remote

    import urllib
    
    from django import http
    from django.utils import simplejson
    from django.template import defaultfilters
    
    from json import JSONChannelBase
    
    __all__ = ['RemoteChannelBase', ]
    
    
    
    [docs]class RemoteChannelBase(JSONChannelBase): """ Uses an API to propose suggestions from an HTTP API, tested with djangorestframework. model_for_source_url A **very important function to override!** take an API URL and return the corresponding model class. This is API specific, there is a complete example in cities_light.contrib. source_url The full URL to the list API. For example, to a djangorestframework list view. An example implementation usage is demonstrated in the django-cities-light contrib folder. Autocomplete box display chronology: - autocomplete.js requests autocomplete box to display for an input, - get_results() fetches some extra results via get_remote_results(), - get_remote_results() calls source_url and returns a list of models, - the remote results are rendered after the local results in widget.html. It includes some JSON in a hidden textarea, like the API's url for each result. Remote result selection chronology: - deck.js calls remoteGetValue() instead of the default getValue(), - remoteGetValue() posts the json from the result to ChannelView, - ChannelView.post() does its job of proxying RemoteChannelBase.post(), - RemoteChannelBase.post() returns an http response which body is just the pk of the result in the local database, using self.fetch_result(), - self.fetch_result() passes the API url of the result and recursively saves the remote models into the local database, returning the id of the newly created object. """ bootstrap = 'remote'
    [docs] def post(self, request, *args, **kwargs): """ Take POST variable 'result', install it in the local database, return the newly created id. The HTTP response has status code 201 Created. """ result = simplejson.loads(request.POST['result']) pk = self.fetch_result(result) return http.HttpResponse(pk, status=201)
    [docs] def model_for_source_url(self, url): """ Take an URL from the API this remote channel is supposed to work with, return the model class to use for that url. It is only needed for the default implementation of fetch(), because it has to follow relations recursively. """ raise NotImplemented()
    [docs] def fetch_result(self, result): """ Take a result's dict representation, return it's local pk which might have been just created. If your channel works with 0 to 1 API call, consider overriding this method. If your channel is susceptible of using several different API calls, consider overriding fetch(). """ return self.fetch(result['source_url']).pk
    [docs] def fetch(self, url): """ Given an url to a remote object, return the corresponding model from the local database. The default implementation expects url to respond with a JSON dict of the attributes of an object. For relation attributes, it expect the value to be another url that will respond with a JSON dict of the attributes of the related object. It calls model_for_source_url() to find which model class corresponds to which url. This allows fetch() to be recursive. """ model_class = self.model_for_source_url(url) fh = urllib.urlopen(url) data = simplejson.loads(fh.read()) data.pop('url') fh.close() for key, value in data.items(): is_string = isinstance(value, (unicode, str)) field = model_class._meta.get_field_by_name(key)[0] if getattr(field, 'rel', None) and is_string: data[key] = self.fetch(value) model, created = model_class.objects.get_or_create(**data) return model
    [docs] def get_results(self, values=None): """ Returns a list of results from both the local database and the API if in the context of a request. Using self.limit_results and the number of local results, adds results from get_remote_results(). """ results = super(RemoteChannelBase, self).get_results(values) unicodes = [unicode(result) for result in results] if self.request: room = self.limit_results - len(results) if room > 0: results = list(results) for result in self.get_remote_results(room): # avoid data that's already in local if unicode(result) in unicodes: continue results.append(result) return results
    [docs] def get_remote_results(self, max): """ Parses JSON from the API, return model instances. The JSON should contain a list of dicts. Each dict should contain the attributes of an object. Relation attributes should be represented by their url in the API, which is set to model._source_url. """ url = self.get_source_url(max) try: fh = urllib.urlopen(url) body = fh.read() except: return else: for data in simplejson.loads(body): url = data.pop('url') for name in data.keys(): field = self.model._meta.get_field_by_name(name)[0] if getattr(field, 'rel', None): data.pop(name) model = self.model(**data) model._source_url = url yield model
    [docs] def result_as_value(self, result): """ Return the result pk or source url. """ result_url = getattr(result, '_source_url', None) if result_url: return defaultfilters.slugify(result_url) else: return result.pk
    [docs] def result_as_dict(self, result): """ Return the result pk or _source_url. """ result_url = getattr(result, '_source_url', None) if result_url: return {'source_url': result_url} else: return {'value': result.pk}
    [docs] def get_source_url(self, limit): """ Return an API url for the current autocomplete request. By default, return self.source_url with the data dict returned by get_source_url_data(). """ return '%s?%s' % (self.source_url, urllib.urlencode( self.get_source_url_data(limit)))
    [docs] def get_source_url_data(self, limit): """ Given a limit of items, return a dict of data to send to the API. By default, it passes current request GET arguments, along with format: 'json' and the limit. """ data = {} if self.request: for key, value in self.request.GET.items(): data[key] = value data.update({ 'format': 'json', 'limit': limit, }) return data

    Project Versions

    PK6@$[$[Rdjango-autocomplete-light-0.8/_modules/autocomplete_light/contrib/generic_m2m.html autocomplete_light.contrib.generic_m2m — django-autocomplete-light 0.7 documentation

    Source code for autocomplete_light.contrib.generic_m2m

    """
    ``autocomplete_light.contrib.generic_m2m`` couples django-autocomplete-light
    with django-generic-m2m.
    
    Generic many to many are supported since 0.5. It depends on `django-generic-m2m
    <http://django-generic-m2m.rtfd.org>`_ external apps. Follow django-generic-m2m
    installation documentation, but at the time of writing it barely consists of
    adding the ``genericm2m`` to ``INSTALLED_APPS``, and adding a field to models
    that should have a generic m2m relation. So, kudos to the maintainers of
    django-generic-m2m, fantastic app, use it for generic many to many relations.
    
    See examples in ``test_project/generic_m2m_example``.
    """
    from genericm2m.models import RelatedObjectsDescriptor
    
    from ..generic import GenericForeignKeyField, GenericModelForm
    
    
    
    [docs]class GenericModelForm(GenericModelForm): """ Extension of autocomplete_light.GenericModelForm, that handles genericm2m's RelatedObjectsDescriptor. """ def __init__(self, *args, **kwargs): """ Add related objects to initial for each generic m2m field. """ super(GenericModelForm, self).__init__(*args, **kwargs) for name, field in self.generic_m2m_fields(): related_objects = getattr(self.instance, name).all() self.initial[name] = [x.object for x in related_objects]
    [docs] def generic_m2m_fields(self): """ Yield name, field for each RelatedObjectsDescriptor of the model of this ModelForm. """ for name, field in self.fields.items(): if not isinstance(field, GenericManyToMany): continue model_class_attr = getattr(self._meta.model, name, None) if not isinstance(model_class_attr, RelatedObjectsDescriptor): continue yield name, field
    [docs] def save(self, commit=True): """ Sorry guys, but we have to force commit=True and call save_m2m() right after. The reason for that is that Django 1.4 kind of left over cases where we wanted to override save_m2m: it enforces its own, which does not care of generic_m2m of course. """ model = super(GenericModelForm, self).save(True) self.save_m2m() return model
    [docs] def save_m2m(self): """ Save selected generic m2m relations. """ if hasattr(super(GenericModelForm, self), 'save_m2m'): # forward compatibility: # Django's ModelForm **should** allow a user to overload the # save_m2m method. As of Django 1.4, it still enforces it's own # save_m2m function... super(GenericModelForm, self).save_m2m() for name, field in self.generic_m2m_fields(): model_attr = getattr(self.instance, name) selected_relations = self.cleaned_data.get(name, []) for related in model_attr.all(): if related.object not in selected_relations: model_attr.remove(related) for related in selected_relations: model_attr.connect(related)
    [docs]class GenericManyToMany(GenericForeignKeyField): """ Simple form field that converts strings to models. """ def prepare_value(self, value): if hasattr(value, '__iter__'): return [super(GenericManyToMany, self).prepare_value(v) for v in value] return super(GenericManyToMany, self).prepare_value(value) def to_python(self, value): if hasattr(value, '__iter__'): return [super(GenericManyToMany, self).to_python(v) for v in value] return super(GenericManyToMany, self).to_python(value)

    Project Versions

    PK6@_Q+V+V(django-autocomplete-light-0.8/quick.htmlPK6@y)(qVdjango-autocomplete-light-0.8/forms.htmlPK6@a`-`-.UPdjango-autocomplete-light-0.8/py-modindex.htmlPK6@"ܣ^^(~django-autocomplete-light-0.8/index.htmlPK6@" 77,django-autocomplete-light-0.8/searchindex.jsPK6@o}[ YY-django-autocomplete-light-0.8/navigation.htmlPK6@=]>>'ndjango-autocomplete-light-0.8/demo.htmlPK6@--+ƭdjango-autocomplete-light-0.8/django13.htmlPK6@b<==*django-autocomplete-light-0.8/generic.htmlPK6@xlKK)ngdjango-autocomplete-light-0.8/objects.invPK6@q?**2ldjango-autocomplete-light-0.8/_admin_template.htmlPK6@;m%%)cdjango-autocomplete-light-0.8/search.htmlPK6@E3>[>[+Bdjango-autocomplete-light-0.8/genindex.htmlPK6@ڌӽ(django-autocomplete-light-0.8/.buildinfoPK6@OF+mm)django-autocomplete-light-0.8/remote.htmlPK6@:>>>4܆django-autocomplete-light-0.8/_static/searchtools.jsPK{6@hkk.django-autocomplete-light-0.8/_static/down.pngPKw6@]w%%1django-autocomplete-light-0.8/_static/default.cssPK6@ڐ((7django-autocomplete-light-0.8/_static/autocomplete.htmlPK6@'cc/django-autocomplete-light-0.8/_static/deck.htmlPK{6@u 81)django-autocomplete-light-0.8/_static/comment-bright.pngPKw6@UNÇ537django-autocomplete-light-0.8/_static/autocomplete.jsPK{6@[{gtt4 django-autocomplete-light-0.8/_static/up-pressed.pngPK{6@+0.django-autocomplete-light-0.8/_static/file.pngPK{6@a.django-autocomplete-light-0.8/_static/plus.pngPKw6@i\``/django-autocomplete-light-0.8/_static/pycco.cssPK{6@2,~~!~!3gdjango-autocomplete-light-0.8/_static/underscore.jsPK{6@h)bb366django-autocomplete-light-0.8/_static/websupport.jsPK{6@DUkk,%django-autocomplete-light-0.8/_static/up.pngPK{6@' 5w 7ښdjango-autocomplete-light-0.8/_static/comment-close.pngPK{6@ 1)django-autocomplete-light-0.8/_static/doctools.jsPK6@3`\\20django-autocomplete-light-0.8/_static/pygments.cssPKlfj@ ==-django-autocomplete-light-0.8/_static/rtd.cssPK{6@kuFpp6(django-autocomplete-light-0.8/_static/down-pressed.pngPK{6@K/django-autocomplete-light-0.8/_static/minus.pngPK{6@Pu u 1django-autocomplete-light-0.8/_static/comment.pngPK6@22}!!/!django-autocomplete-light-0.8/_static/basic.cssPK{6@<>5 Cdjango-autocomplete-light-0.8/_static/ajax-loader.gifPK{6@l80Fdjango-autocomplete-light-0.8/_static/sidebar.jsPK{6@4/Xdjango-autocomplete-light-0.8/_static/jquery.jsPK6@*V*V:!s django-autocomplete-light-0.8/.doctrees/navigation.doctreePK6@]4mm8 django-autocomplete-light-0.8/.doctrees/django13.doctreePK6@;fKfK4f django-autocomplete-light-0.8/.doctrees/demo.doctreePK6@6( django-autocomplete-light-0.8/.doctrees/remote.doctreePK6@QAPP?j django-autocomplete-light-0.8/.doctrees/_admin_template.doctreePK6@j5ڔ7 django-autocomplete-light-0.8/.doctrees/generic.doctreePK6@zz: django-autocomplete-light-0.8/.doctrees/environment.picklePK6@ϟ1t1t5Xe django-autocomplete-light-0.8/.doctrees/quick.doctreePK6@Kk5 django-autocomplete-light-0.8/.doctrees/index.doctreePK6@jWGWG5Mdjango-autocomplete-light-0.8/.doctrees/forms.doctreePKw6@*c3aa1django-autocomplete-light-0.8/_sources/remote.txtPKw6@v0django-autocomplete-light-0.8/_sources/forms.txtPKw6@2a<<0django-autocomplete-light-0.8/_sources/index.txtPKw6@+|/fdjango-autocomplete-light-0.8/_sources/demo.txtPKw6@V5tdjango-autocomplete-light-0.8/_sources/navigation.txtPKw6@2__2django-autocomplete-light-0.8/_sources/generic.txtPKw6@>  0django-autocomplete-light-0.8/_sources/quick.txtPKw6@3R*django-autocomplete-light-0.8/_sources/django13.txtPKw6@q :r-django-autocomplete-light-0.8/_sources/_admin_template.txtPK6@}E{'{'1.django-autocomplete-light-0.8/_modules/index.htmlPK6@DDDVdjango-autocomplete-light-0.8/_modules/autocomplete_light/forms.htmlPK6@A4r4rFdjango-autocomplete-light-0.8/_modules/autocomplete_light/widgets.htmlPK6@YYFdjango-autocomplete-light-0.8/_modules/autocomplete_light/generic.htmlPK6@P ssGhdjango-autocomplete-light-0.8/_modules/autocomplete_light/registry.htmlPK6@99D$django-autocomplete-light-0.8/_modules/autocomplete_light/views.htmlPK6@:M4D~D~KIdjango-autocomplete-light-0.8/_modules/autocomplete_light/channel/base.htmlPK6@x`KNKNNdjango-autocomplete-light-0.8/_modules/autocomplete_light/channel/generic.htmlPK6@xԆԆMdjango-autocomplete-light-0.8/_modules/autocomplete_light/channel/remote.htmlPK6@$[$[Rkdjango-autocomplete-light-0.8/_modules/autocomplete_light/contrib/generic_m2m.htmlPKEEk