diff --git a/test_project/taggit_autocomplete/README.md b/test_project/taggit_autocomplete/README.md new file mode 100644 index 000000000..25c1ac70b --- /dev/null +++ b/test_project/taggit_autocomplete/README.md @@ -0,0 +1,4 @@ +App to show support for django-taggit. + +Make sure to run ./manage.py migrate to create taggit tables. + diff --git a/test_project/taggit_autocomplete/__init__.py b/test_project/taggit_autocomplete/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/test_project/taggit_autocomplete/admin.py b/test_project/taggit_autocomplete/admin.py new file mode 100644 index 000000000..070e7820a --- /dev/null +++ b/test_project/taggit_autocomplete/admin.py @@ -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) diff --git a/test_project/taggit_autocomplete/autocomplete_light_registry.py b/test_project/taggit_autocomplete/autocomplete_light_registry.py new file mode 100644 index 000000000..d852599ba --- /dev/null +++ b/test_project/taggit_autocomplete/autocomplete_light_registry.py @@ -0,0 +1,5 @@ +import autocomplete_light +from taggit.models import Tag + +autocomplete_light.register(Tag) + diff --git a/test_project/taggit_autocomplete/forms.py b/test_project/taggit_autocomplete/forms.py new file mode 100644 index 000000000..b2d41abd3 --- /dev/null +++ b/test_project/taggit_autocomplete/forms.py @@ -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'), + } + diff --git a/test_project/taggit_autocomplete/models.py b/test_project/taggit_autocomplete/models.py new file mode 100644 index 000000000..0138bf37c --- /dev/null +++ b/test_project/taggit_autocomplete/models.py @@ -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 + diff --git a/test_project/taggit_autocomplete/urls.py b/test_project/taggit_autocomplete/urls.py new file mode 100644 index 000000000..38bc7d776 --- /dev/null +++ b/test_project/taggit_autocomplete/urls.py @@ -0,0 +1,7 @@ +from django.conf.urls import patterns, url +from views import TaggitDemoCreate + +urlpatterns = patterns('', + url(r'^create/$', TaggitDemoCreate.as_view()), +) + diff --git a/test_project/taggit_autocomplete/views.py b/test_project/taggit_autocomplete/views.py new file mode 100644 index 000000000..aa7e07f8a --- /dev/null +++ b/test_project/taggit_autocomplete/views.py @@ -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 + diff --git a/test_project/test_project/settings.py b/test_project/test_project/settings.py index 4a0a22565..87fb26556 100644 --- a/test_project/test_project/settings.py +++ b/test_project/test_project/settings.py @@ -177,6 +177,7 @@ 'default_template_autocomplete', 'ajax_create', 'taggit', + 'taggit_autocomplete', ) # A sample logging configuration. The only tangible logging diff --git a/test_project/test_project/urls.py b/test_project/test_project/urls.py index 244027ae1..db32b500a 100644 --- a/test_project/test_project/urls.py +++ b/test_project/test_project/urls.py @@ -40,7 +40,8 @@ (r'^i18n/', include('django.conf.urls.i18n')), (r'^just_javascript/$', generic.TemplateView.as_view( template_name='just_javascript.html')), - (r'^$', generic.TemplateView.as_view(template_name='index.html')) + (r'^$', generic.TemplateView.as_view(template_name='index.html')), + url('r^taggit_autocomplete/', include('taggit_autocomplete.urls')), ) if hvad: