Coder Social home page Coder Social logo

raagin / django-tagging-autocomplete Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ludwiktrammer/django-tagging-autocomplete

0.0 1.0 0.0 317 KB

jquery-autocomplete widget for django-tagging

License: MIT License

Python 99.17% CSS 0.83%

django-tagging-autocomplete's Introduction

django-tagging-autocomplete

django-tagging-autocomplete is a jquery based autocomplete solution for django-tagging.

Requirements

  • django-tagging

Setup

  1. Download package and install, for example using pip:

    pip install django-tagging-autocomplete
    
  2. Add tagging_autocomplete to installed apps in your project's settings.

  3. Add the following line to your project's urls.py file:

    (r'^tagging_autocomplete/', include('tagging_autocomplete.urls')),
    

Usage

The Model Field

You can use TagAutocompleteField() to enable autocompletion right in your models.py. In most cases this is the easiest solution:

from django.db import models
from tagging_autocomplete.models import TagAutocompleteField

class SomeModel(models.Model):
        tags = TagAutocompleteField()

The Form Widget

Alternatively you can use the TagAutocomplete() form widget while creating your form:

from django import forms
from tagging.forms import TagField
from tagging_autocomplete.widgets import TagAutocomplete

class SomeForm(forms.Form):
    tags = TagField(widget=TagAutocomplete())

Optional settings

By default the maximum number of results suggested by the autocompletion is 100. You can modify this number by adding to your settings.py project file the TAGGING_AUTOCOMPLETE_MAX_RESULTS constant. For example:

TAGGING_AUTOCOMPLETE_MAX_RESULTS = 5

By default autocompletion suggests tags that start with a given term. In case you need to show ones that contain the given term, set TAGGING_AUTOCOMPLETE_SEARCH_CONTAINS to True. For example:

TAGGING_AUTOCOMPLETE_SEARCH_CONTAINS = True

By default suggestions are shown right after you enter first character. You can configure this behaviour using TAGGING_AUTOCOMPLETE_MIN_LENGTH. For example:

TAGGING_AUTOCOMPLETE_MIN_LENGTH = 3

django-tagging-autocomplete's People

Contributors

armonge avatar lucastheis avatar ludwiktrammer avatar nawre avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.