Giter Club home page Giter Club logo

django-taggit-labels's Introduction

django-taggit-labels

image

Label widget(s) for django-taggit.

Now instead of this:

image

You can use this:

image

Overview

This is a widget for use in the Django admin interface, and it depends on Django's namespaced jQuery. It allows you to add and remove tags by selecting or deselecting visual labels.

The label widget does not expose the input field so that you can add new tags. The base label widget instead shows all available tags and lets you pick between them in Django's admin interface. It presumes that you are using a managed (or 'curated' if you're feeling insufferable) tag list.

Quickstart

Install django-taggit-labels:

pip install django-taggit-labels

Add taggit_labels to your project:

INSTALLED_APPS = (
    'taggit',
    'taggit_labels',
)

Use the label widget:

from taggit.forms import TagField
from taggit_labels.widgets import LabelWidget

class ContentForm(forms.ModelForm):
    tags = TagField(required=False, widget=LabelWidget)

Just use this form class for your ModelAdmin class now:

class ContentAdmin(admin.ModelAdmin):
    form = ContentAdminForm

You can use the widget with your own tag model, too:

from taggit.forms import TagField
from taggit_labels.widgets import LabelWidget

class ContentForm(forms.Form):
    tags = TagField(required=False, widget=LabelWidget(model=MyTag))

The tag model from taggit will be presumed if you do not specify a tag model.

django-taggit-labels's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

django-taggit-labels's Issues

Question about using taggit-labels

Hi Ben,
I'm new in Python-Django world. I read your documentation and I didn't understood how to use django-taggit-labels. Can you make simple example with detailed comments?

ReferenceError: django is not defined })(django.jQuery);

i'm using python 2.7 django 1.9.1

followed the quick start guide and got the following error, did I miss out anything?

ReferenceError: django is not defined
})(django.jQuery);

The tags are showing up on the form, but I could not select/de-select them.

screen shot 2016-01-15 at 5 36 53 pm

Add New Tag?

Would be great if this also optionally included a way to create a new tag as opposed to only using a curated list of tags.

Perhaps the last tag in the list is a "plus" symbol and when you click on it, it becomes a text field styled like an unselected tag...

Installing django-taggit-labels

When I am entering pipl ist install django-taggit-labels and then trying to use them in admin page occurs error like in issue #23 . But when I am reinstalling that by pip install git+https://giyhub.com/bennylope/django-taggit-labels - there's no problems.

Test errors

Hi,

I started to contribute with this project and I followed the steps of CONTRIBUTING.rst but I can't pass flake8 and integration tests.

Specifically when try to pass test_custom_selected_tags and acces to self.post.tags.all(), raise next error:

E django.core.exceptions.FieldError: Cannot resolve keyword 'None' into field. Choices are: description, id, mycontent, name, slug, taggedwhatever
.tox/py34-django19/lib/python3.4/site-packages/django/db/models/sql/query.py:1330: FieldError

On the other hand I would like to contribute reformatting the widget class to allow more flexibility to extends and overwrite some methods of it. However I don't know if I should continue without passing tests.

Tags with part in double quotes split by TaggableManager on save

Steps to reproduce:

  1. Create a tag with name that contains part in double quotes, like testing "tags separation"
  2. Open in the admin interface and edit any taggable model instance.
    Result: two new tags created, testing and tags separation.

Not a major problem, just FYI.

New release?

Just stumbled upon this package and it's create, however the released 0.6.0 doesn't seem to work well with DJango 2.2/Crispy Forms even though master does. Any chance you could push a new release sometime soon?

Disabling?

Hi there,

Just wondering if anyone else has found a clean way to disable the element? Adding a disabled property only applies to the main ul element and not the created li elements.

The format for the labels is great, but being able to disable the fields is important.

Django 1.9 compatibility

Django 1.9 will deprecate django.forms.util in favor of django.forms.utils namespace (it's already renamed). Changes has to be made in widgets.py imports.

TaggableMananger changing name

The JavaScript only supports one attribute name for the tags manager (tags). The TaggableManager however can be assigned to any attribute name breaking the js.

var inputs = $("input#id_tags")[0];

got a SyntaxError

I follow the quickstart, and do the same thing.

my enviorment is python 3.4 django 1.6.5

python show the error non-keyword arg after keyword arg

here is my code

from django import forms
from .models import Post
from taggit_labels.widgets import LabelWidget
from taggit.models import TaggedItem
from taggit.forms import *
class PostForm(forms.ModelForm):
    tags = TagField(required=False, LabelWidget)
    class Meta:
        model = Post

need a help

i solve problem

tags_suggest = TagField(required=False, widget=LabelWidget)

but i got another problem, it doesn't able click and relate to tag field

it show tags are pure text not a link

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.