Skip to content

Commit

Permalink
Add demo for icon cache with lots of icons
Browse files Browse the repository at this point in the history
  • Loading branch information
christianwgd committed Aug 17, 2024
1 parent b80d9c6 commit 0e4583d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,4 +234,16 @@ <h4>Icons on buttons</h4>
{% md_icon 'alarm' %} Material
</button>

<h4>Icon cache</h4>
<p>Even hundrets of icons shouldn't be a problem, if the icon cache is enabled</p>

<table>
<tbody>
{% for i in loop %}
{% for icon_name in test_icon_names %}
<tr><td>{{ icon_name }}</td><td>{% bs_icon icon_name %}</td></tr>
{% endfor %}
{% endfor %}
</tbody>
</table>
{% endblock %}
7 changes: 7 additions & 0 deletions django_bootstrap_icons_sample/views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import re
from lib2to3.fixes.fix_input import context

Check failure on line 2 in django_bootstrap_icons_sample/views.py

View workflow job for this annotation

GitHub Actions / build (3.10)

Ruff (F401)

django_bootstrap_icons_sample/views.py:2:37: F401 `lib2to3.fixes.fix_input.context` imported but unused

Check failure on line 2 in django_bootstrap_icons_sample/views.py

View workflow job for this annotation

GitHub Actions / build (3.11)

Ruff (F401)

django_bootstrap_icons_sample/views.py:2:37: F401 `lib2to3.fixes.fix_input.context` imported but unused

Check failure on line 2 in django_bootstrap_icons_sample/views.py

View workflow job for this annotation

GitHub Actions / build (3.12)

Ruff (F401)

django_bootstrap_icons_sample/views.py:2:37: F401 `lib2to3.fixes.fix_input.context` imported but unused

from django.shortcuts import render
from django.views.generic.base import TemplateView
Expand All @@ -10,6 +11,12 @@
class SamplesView(TemplateView):
template_name = "django_bootstrap_icons_sample/samples.html"

def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)

Check failure on line 15 in django_bootstrap_icons_sample/views.py

View workflow job for this annotation

GitHub Actions / build (3.10)

Ruff (F811)

django_bootstrap_icons_sample/views.py:15:9: F811 Redefinition of unused `context` from line 2

Check failure on line 15 in django_bootstrap_icons_sample/views.py

View workflow job for this annotation

GitHub Actions / build (3.11)

Ruff (F811)

django_bootstrap_icons_sample/views.py:15:9: F811 Redefinition of unused `context` from line 2

Check failure on line 15 in django_bootstrap_icons_sample/views.py

View workflow job for this annotation

GitHub Actions / build (3.12)

Ruff (F811)

django_bootstrap_icons_sample/views.py:15:9: F811 Redefinition of unused `context` from line 2
context['test_icon_names'] = ['airplane', 'apple', 'archive', 'asterisk', 'ban']
context['loop'] = range(0, 99)

Check failure on line 17 in django_bootstrap_icons_sample/views.py

View workflow job for this annotation

GitHub Actions / build (3.10)

Ruff (PIE808)

django_bootstrap_icons_sample/views.py:17:33: PIE808 Unnecessary `start` argument in `range`

Check failure on line 17 in django_bootstrap_icons_sample/views.py

View workflow job for this annotation

GitHub Actions / build (3.11)

Ruff (PIE808)

django_bootstrap_icons_sample/views.py:17:33: PIE808 Unnecessary `start` argument in `range`

Check failure on line 17 in django_bootstrap_icons_sample/views.py

View workflow job for this annotation

GitHub Actions / build (3.12)

Ruff (PIE808)

django_bootstrap_icons_sample/views.py:17:33: PIE808 Unnecessary `start` argument in `range`
return context


# pylint: disable=too-many-branches
def icon_view(request):
Expand Down

0 comments on commit 0e4583d

Please sign in to comment.