Skip to content
This repository was archived by the owner on Mar 17, 2024. It is now read-only.

Commit 94f35fc

Browse files
committed
Added tags for Apps
1 parent 8127194 commit 94f35fc

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

components/studio/models/templates/models_cards.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
{% block content %}
55
<div style="display: inline-flex;">
66
<h1 class="h3 mb-3" style="margin-right: 5px;">Models</h1>
7-
<h1 class="h3 mb-3 ghost-number">{{ published_models|length }}</h1>
7+
<h1 class="h3 mb-3 ghost-number">{% if published_models|length > 0 %}{{ published_models|length }}{% endif %}</h1>
88
<div>
99
{% for tf in request.session.tag_filters %}
10-
<div class="tag tag-list"><a class="tag-list-ico fas fa-times" style="color: #fffafa;"
11-
href="{% url 'models:index' %}?tf_remove={{ tf | urlencode }}"></a><span style="font-weight: 500;">{{ tf }}</span></div>
10+
<div class="tag tag-list"><a class="tag-list-ico fas fa-times" style="color: #fffafa;" href="{% url 'models:index' %}?tf_remove={{ tf | urlencode }}"></a><span style="font-weight: 500;">{{ tf }}</span></div>
1211
{% endfor %}
1312
</div>
1413
</div>

components/studio/models/templates/models_details_public.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ <h5 class="card-title mb-0">{{ model.name }}</h5>
3232
<p class="mb-0">{{ model.uploaded_at }}</p>
3333
</dd>
3434
</dl>
35-
{{user.is_authenticated}}
3635
{% if request.user and request.user.is_authenticated and request.user == model.project.owner or request.user.is_superuser %}
3736
<hr>
3837
<form method="POST" autocomplete="off" action="{% if private %}{% url 'models:add_tag_private' request.user project.slug model.id %}{% else %}{% url 'models:add_tag' published_model.id model.id %}{% endif %}">

components/studio/models/templatetags/__init__.py

Whitespace-only changes.

components/studio/models/templatetags/custom_tags.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
from django import template
2+
from django.db.models.functions import Length
23
import json
34

45
register = template.Library()
56

67
@register.filter(name='split')
78
def split(value, arg):
8-
return value.all()
9+
return value.all().order_by(Length('name').desc())
910

1011
@register.filter
1112
def sort_by(queryset, order):
@@ -18,16 +19,19 @@ def exists(value, arg):
1819
return False
1920

2021
@register.filter(name='count_str')
21-
def split(value):
22+
def count_str(value):
2223
total_length = 0
2324
num_tags = 0
25+
final_length = 42
2426
for tag in value:
2527
total_length += len(str(tag))
26-
if total_length > 50:
28+
if total_length > final_length:
2729
break
30+
# final_length = final_length-8
2831
num_tags += 1
2932
if num_tags == 0:
3033
num_tags = 1
34+
print("LIMITS: ", num_tags,total_length)
3135
return num_tags
3236

3337
@register.filter(name='subtract')

0 commit comments

Comments
 (0)