-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This app shows how to integrate django-autocomple-light with django-taggit.
- Loading branch information
1 parent
714d1de
commit a2967bb
Showing
10 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
App to show support for django-taggit. | ||
|
||
Make sure to run ./manage.py migrate to create taggit tables. | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from django.contrib import admin | ||
from models import TaggitDemo | ||
from forms import TaggitDemoForm | ||
|
||
class TaggitDemoAdmin(admin.ModelAdmin): | ||
model = TaggitDemo | ||
form = TaggitDemoForm | ||
|
||
admin.site.register(TaggitDemo, TaggitDemoAdmin) |
5 changes: 5 additions & 0 deletions
5
test_project/taggit_autocomplete/autocomplete_light_registry.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import autocomplete_light | ||
from taggit.models import Tag | ||
|
||
autocomplete_light.register(Tag) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from django import forms | ||
import autocomplete_light | ||
from autocomplete_light.contrib import taggit_tagfield | ||
from models import TaggitDemo | ||
|
||
class TaggitDemoForm(forms.ModelForm): | ||
tags = taggit_tagfield.TagField(widget=taggit_tagfield.TagWidget('TagAutocomplete')) | ||
class Meta: | ||
model = TaggitDemo | ||
widgets = { | ||
'tags': autocomplete_light.TextWidget('TagAutocomplete'), | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from django.db import models | ||
from taggit.managers import TaggableManager | ||
|
||
class TaggitDemo(models.Model): | ||
name = models.CharField(max_length=255) | ||
tags = TaggableManager(blank=True) | ||
|
||
def __unicode__(self): | ||
return self.name | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from django.conf.urls import patterns, url | ||
from views import TaggitDemoCreate | ||
|
||
urlpatterns = patterns('', | ||
url(r'^create/$', TaggitDemoCreate.as_view()), | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from django.views.generic.edit import CreateView | ||
from models import TaggitDemo | ||
from forms import TaggitDemoForm | ||
|
||
class TaggitDemoCreate(CreateView): | ||
model = TaggitDemo | ||
form_class = TaggitDemoForm | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters