Skip to main content

django-ktag

django tag input field

Home | Documentation

https://github.com/gojuukaze/django-ktag/blob/master/demo.gif?raw=true

Install

pip install django-ktag

Requirements

  • python 3+

  • django 2+

Quick Start

  • The settings

  1. Add ‘ktag’ application to the INSTALLED_APPS

INSTALLED_APPS = [
...
'ktag',
]
  1. Make sure APP_DIRS is True in TEMPLATES

TEMPLATES = [
...
'APP_DIRS': True,
...
]
  • The form class

Building a form in Django like this:

from django import forms
from ktag.fields import TagField

class TagForm(forms.Form):
    fruits = TagField(label='fruits', place_holder='write your fruits', delimiters=' ',
                      data_list=['apple', 'banana', 'watermelon', 'orange'], initial='grape coconut')
  • The view

To handle the form we need to instantiate it in the view for the URL where we want it to be published:

from django.http import HttpResponse
from django.shortcuts import render

from example.forms import TagForm

def index(request):
    if request.method == 'POST':
        form = TagForm(request.POST)
        if form.is_valid():
            print(form.cleaned_data['fruits'])
            return HttpResponse(str(form.cleaned_data['fruits']))

    else:
        form = TagForm()
    return render(request, 'index.html', {'form': form})
  • The template

The simplest example is:

<form action="" method="post">
    {% csrf_token %}
    {{ form }}
    <br>
    <input type="submit" value="OK" style="font-size: larger">
</form>

Metadata

Release files for django-ktag 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-ktag 1.0.3
File Size Uploaded Provenance Actions
django-ktag-1.0.3.tar.gz 23.4 kB Without provenance Details for django-ktag-1.0.3.tar.gz

Release files / django-ktag-1.0.3.tar.gz

Download URL django-ktag-1.0.3.tar.gz
Size 23.4 kB
Tags Source
SHA-256 checksum
How to use checksums
eb057f995bbf793b68669bdb01729716653ac39f0447e936d875ca65bf186d94
BLAKE2b-256 checksum
How to use checksums
ae37637b232365f052f7a8fbf20f7e06803c2552dbfdee56b6c603849d9acfdf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-ktag 1.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page