Skip to content

Commit 99d7c6b

Browse files
committed
fix: widget inheritance and template issues
- Changed RemixIconWidget to inherit from Select instead of Widget to properly handle choices - Added missing template file for RemixIconWidget - Fixed widget initialization to properly handle icon choices - Updated version to 1.0.2 This commit fixes the "Widget.__init__() got an unexpected keyword argument 'choices'" error and the "TemplateDoesNotExist" error for the widget template.
1 parent 04a5258 commit 99d7c6b

File tree

7 files changed

+32
-8
lines changed

7 files changed

+32
-8
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ If applicable, add screenshots to help explain your problem.
2727
- OS: [e.g. Ubuntu 22.04]
2828
- Python Version: [e.g. 3.9.5]
2929
- Django Version: [e.g. 4.2.0]
30-
- django-remix-icon Version: [e.g. 1.0.0]
30+
- django-remix-icon Version: [e.g. 1.0.2]
3131

3232
**Additional Context**
3333
Add any other context about the problem here.

django_remix_icon/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717

1818
from typing import Final
1919

20-
__version__: Final[str] = "1.0.0"
20+
__version__: Final[str] = "1.0.2"
2121
__author__: Final[str] = "Berkay Şen"
2222
__email__: Final[str] = "brktrl@protonmail.ch"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{% extends "django/forms/widgets/select.html" %}
2+
3+
{% block optgroups %}
4+
{% for group_name, group_choices, group_index in widget.optgroups %}
5+
{% if group_name %}
6+
<optgroup label="{{ group_name }}">
7+
{% endif %}
8+
{% for option in group_choices %}
9+
{% include "django/forms/widgets/select_option.html" with widget=option %}
10+
{% endfor %}
11+
{% if group_name %}
12+
</optgroup>
13+
{% endif %}
14+
{% endfor %}
15+
{% endblock %}
16+
17+
{% block value %}
18+
{% if widget.value %}
19+
<div class="remix-icon-preview">
20+
<i class="ri-{{ widget.value }}"></i>
21+
<span class="icon-name">{{ widget.value }}</span>
22+
</div>
23+
{% endif %}
24+
{% endblock %}

django_remix_icon/widgets.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from typing import Any, Dict, Optional
44

5-
from django.forms import Media, Widget
5+
from django.forms import Media
66
from django.forms.widgets import Select
77
from django.utils.safestring import mark_safe
88
from django.conf import settings
@@ -11,7 +11,7 @@
1111
from django_remix_icon.defaults import REMIX_ICON_CDN_URL
1212

1313

14-
class RemixIconWidget(Widget):
14+
class RemixIconWidget(Select):
1515
"""
1616
A custom select widget for choosing Remix Icons with preview functionality.
1717

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
project = "Django Remix Icon"
3838
copyright = "2025, Berkay Şen"
3939
author = "Berkay Şen"
40-
release = "1.0.0"
41-
version = "1.0.0"
40+
release = "1.0.2"
41+
version = "1.0.2"
4242

4343
# -- General configuration ---------------------------------------------------
4444
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "django-remix-icon"
7-
version = "1.0.0"
7+
version = "1.0.2"
88
description = "Django field and template tags for Remix Icons with admin integration"
99
readme = "README.md"
1010
requires-python = ">=3.8"

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name="django-remix-icon",
5-
version="1.0.0",
5+
version="1.0.2",
66
description="Django field and template tags for Remix Icons with admin integration",
77
long_description=open("README.md").read(),
88
long_description_content_type="text/markdown",

0 commit comments

Comments
 (0)