Coder Social home page Coder Social logo

mohammadrezatavakoli / django-taggit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jazzband/django-taggit

1.0 0.0 0.0 918 KB

Simple tagging for django

Home Page: https://django-taggit.readthedocs.io

License: BSD 3-Clause "New" or "Revised" License

Python 99.92% HTML 0.08%

django-taggit's Introduction

django-taggit

Jazzband Supported Python versions Supported Django versions GitHub Actions https://codecov.io/gh/jazzband/django-taggit/coverage.svg?branch=master

This is a Jazzband project. By contributing you agree to abide by the Contributor Code of Conduct and follow the guidelines.

django-taggit a simpler approach to tagging with Django. Add "taggit" to your INSTALLED_APPS then just add a TaggableManager to your model and go:

from django.db import models

from taggit.managers import TaggableManager


class Food(models.Model):
    # ... fields here

    tags = TaggableManager()

Then you can use the API like so:

>>> apple = Food.objects.create(name="apple")
>>> apple.tags.add("red", "green", "delicious")
>>> apple.tags.all()
[<Tag: red>, <Tag: green>, <Tag: delicious>]
>>> apple.tags.remove("green")
>>> apple.tags.all()
[<Tag: red>, <Tag: delicious>]
>>> Food.objects.filter(tags__name__in=["red"])
[<Food: apple>, <Food: cherry>]

Tags will show up for you automatically in forms and the admin.

django-taggit requires Django 1.11 or greater.

For more info check out the documentation. And for questions about usage or development you can create an issue on Github (if your question is about usage please add the question tag).

django-taggit's People

Contributors

alex avatar frewsxcv avatar apollo13 avatar jdufresne avatar rtpg avatar carljm avatar prydie avatar auvipy avatar collinanderson avatar kaedroho avatar nemesifier avatar entequak avatar blueyed avatar mx-moth avatar idanz avatar frankwiles avatar izquierdo avatar jezdez avatar atombrella avatar soulshake avatar kminkov avatar xordoquy avatar jwhitlock avatar 9nix00 avatar hramezani avatar nicholasserra avatar kuter avatar funkybob avatar rihoward avatar mcroydon avatar

Stargazers

Roman 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.