Skip to content

Commit

Permalink
admin form中的显示问题
Browse files Browse the repository at this point in the history
  • Loading branch information
gojuukaze committed Jan 28, 2022
1 parent 855f8ae commit c977f8e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# django-tagify2

[![GitHub version](https://img.shields.io/badge/version-1.0.13-blue.svg)](https://pypi.org/project/django-tagify2/)
[![GitHub version](https://img.shields.io/badge/version-1.0.14-blue.svg)](https://pypi.org/project/django-tagify2/)
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20V3-blue.svg)](https://github.com/gojuukaze/django-tagify2/blob/master/LICENSE)

django tag input field using [tagify](https://github.com/yairEO/tagify)
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class People(models.Model): name = models.Cha
.. _Field Arguments: #field-arguments
.. _Example: #example

.. |GitHub version| image:: https://img.shields.io/badge/version-1.0.3-blue.svg
.. |GitHub version| image:: https://img.shields.io/badge/version-1.0.14-blue.svg
:target: https://pypi.org/project/django-tagify2/
.. |License: GPL v3| image:: https://img.shields.io/badge/License-GPL%20V3-blue.svg
:target: https://github.com/gojuukaze/django-tagify2/blob/master/LICENSE
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name='django-tagify2',
version='1.0.13',
version='1.0.14',
description='django tag input field using tagify.js',
url='https://github.com/gojuukaze/django-tagify2',
author="gojuukaze",
Expand Down
9 changes: 9 additions & 0 deletions tagify/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ class Media:
tag_args = {}
var_name = None

def format_value(self, value):
if not value:
return ''
if isinstance(value, list):
tag_args = getattr(self, "tag_args", {})
delimiters = getattr(tag_args, 'delimiters', ' ')
return delimiters.join(value)
return super(TagInput, self).format_value(value)

def get_context(self, name, value, attrs):
context = super().get_context(name, value, attrs)
context["widget"]["type"] = self.input_type
Expand Down

0 comments on commit c977f8e

Please sign in to comment.