This repository was archived by the owner on Mar 17, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +9
-7
lines changed Expand file tree Collapse file tree 4 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 4
4
{% block content %}
5
5
< div style ="display: inline-flex; ">
6
6
< 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 >
8
8
< div >
9
9
{% 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 >
12
11
{% endfor %}
13
12
</ div >
14
13
</ div >
Original file line number Diff line number Diff line change @@ -32,7 +32,6 @@ <h5 class="card-title mb-0">{{ model.name }}</h5>
32
32
< p class ="mb-0 "> {{ model.uploaded_at }}</ p >
33
33
</ dd >
34
34
</ dl >
35
- {{user.is_authenticated}}
36
35
{% if request.user and request.user.is_authenticated and request.user == model.project.owner or request.user.is_superuser %}
37
36
< hr >
38
37
< 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 %} ">
Original file line number Diff line number Diff line change 1
1
from django import template
2
+ from django .db .models .functions import Length
2
3
import json
3
4
4
5
register = template .Library ()
5
6
6
7
@register .filter (name = 'split' )
7
8
def split (value , arg ):
8
- return value .all ()
9
+ return value .all (). order_by ( Length ( 'name' ). desc ())
9
10
10
11
@register .filter
11
12
def sort_by (queryset , order ):
@@ -18,16 +19,19 @@ def exists(value, arg):
18
19
return False
19
20
20
21
@register .filter (name = 'count_str' )
21
- def split (value ):
22
+ def count_str (value ):
22
23
total_length = 0
23
24
num_tags = 0
25
+ final_length = 42
24
26
for tag in value :
25
27
total_length += len (str (tag ))
26
- if total_length > 50 :
28
+ if total_length > final_length :
27
29
break
30
+ # final_length = final_length-8
28
31
num_tags += 1
29
32
if num_tags == 0 :
30
33
num_tags = 1
34
+ print ("LIMITS: " , num_tags ,total_length )
31
35
return num_tags
32
36
33
37
@register .filter (name = 'subtract' )
You can’t perform that action at this time.
0 commit comments