Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/giginet/django-generic-tagging
A generic tagging plugin for Django
https://github.com/giginet/django-generic-tagging
Last synced: about 2 months ago
JSON representation
A generic tagging plugin for Django
- Host: GitHub
- URL: https://github.com/giginet/django-generic-tagging
- Owner: giginet
- License: mit
- Created: 2016-03-20T07:29:25.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2021-06-10T18:40:26.000Z (over 3 years ago)
- Last Synced: 2024-11-14T22:11:11.210Z (about 2 months ago)
- Language: Python
- Homepage:
- Size: 68.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.rst
- License: LICENSE.md
Awesome Lists containing this project
README
django-generic-tagging
=========================.. image:: https://travis-ci.org/giginet/django-generic-tagging.svg?branch=master
:target: https://travis-ci.org/giginet/django-generic-tagging.. image:: https://coveralls.io/repos/github/giginet/django-generic-tagging/badge.svg?branch=master
:target: https://coveralls.io/github/giginet/django-generic-tagging?branch=master
.. image:: https://img.shields.io/pypi/status/django-generic-tagging.svg
:target: https://pypi.python.org/pypi/django-generic-tagging.. image:: https://img.shields.io/pypi/pyversions/django-generic-tagging.svg
:target: https://pypi.python.org/pypi/django-generic-tagging.. image:: https://img.shields.io/pypi/l/django-generic-tagging.svg
:target: https://github.com/giginet/django-generic-tagging/blob/master/LICENSE.mdAuthor
giginet
Supported python versions
3.3, 3.4, 3.5
Supported django versions
Django 1.7 - 1.9A generic tagging library which enables to attach tags for every objects.
Sample Application
--------------------------https://django-generic-tagging.herokuapp.com/
Installation
------------
Use pip_ like::$ pip install django-generic-tagging
.. _pip: https://pypi.python.org/pypi/pip
Requirements
---------------------- djangorestframework_
- jQuery 1.x / 2.x.. _djangorestframework: http://www.django-rest-framework.org/
Usage
--------------You should refer the example application for detail.
Configuration
~~~~~~~~~~~~~~~~~1. Put ``generic_tagging`` into your ``INSTALLED_APPS`` at settings module
.. code:: python
INSTALLED_APPS = (
...
'generic_tagging',
)2. Add URL patterns into your `urls.py`
.. code:: python
from django.conf.urls import include, url
from django.contrib import adminfrom generic_tagging.api.routers import TaggingAPIRouter
tagging_router = TaggingAPIRouter(trailing_slash=True)
urlpatterns = [
...
url(r'^tags/', include('generic_tagging.urls')),
url(r'^api/', include(tagging_router.urls)),
]3. Create ``generic_tagging`` database tables by running::
$ python manage.py migrate
How to add tagging feature to your model
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~All you have to do is embed the two template tags into your models' templates.
1. Add ``{% load tagging %}`` to load tagging module
2. Place ``{% render_generic_tagging_head_tag %}`` into ```` tag
3. Place ``{% render_generic_tagging_component_tag_for object %}`` to where you like.
.. code:: html
{% load tagging %}
{% render_generic_tagging_head_tag %}
...
{{ object.title }}
{% render_generic_tagging_component_tag_for object %}
Views
-----------------.. table:: This library has two default views.
=========== ========================================== ============================
Description Template path Reversed URL name
=========== ========================================== ============================
Tag list /templates/generic_tagging/tag_list.html generic_tagging_tag_list
Tag detail /templates/generic_tagging/tag_detail.html generic_tagging_tag_detail
=========== ========================================== ============================Tag list
~~~~~~~~~~~~~This view displays all tags.
``templates/generic_tagging/tag_list.html`` should be used as the template.
.. code:: html
All available tags
- {{ tag.label }}
{% for tag in object_list %}
{% endfor %}
Tag detail
~~~~~~~~~~~~~~
Each tags have permalinks to display all related objects.
``templates/generic_tagging/tag_detail.html`` should be used as the template.
.. code:: html
All contents relative with {{ object.label }}
- {{ item.content_object }}
{% for item in object.items.all %}
{% endfor %}
API
------------------
``django-generic-tagging`` has REST-ful APIs.
.. table:: List of API endpoints.
========================= ========== ======================
Endpoint Method Reversed URL name
========================= ========== ======================
/tag/ GET ``tag-list``
/tagged_item/ GET ``tagged_item-list``
/tagged_item// GET ``tagged_item-detail``
/tagged_item/ CREATE ``tagged_item-list``
/tagged_item// DELETE ``tagged_item-detail``
/tagged_item//lock/ PATCH ``tagged_item-lock``
/tagged_item//unlock/ PATCH ``tagged_item-unlock``
========================= ========== ======================
License
------------------------
The MIT License (MIT)
Copyright (c) 2016 giginet
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.