Add !untagged search to find untagged bookmarks
* Add .nvmrc file for easier Node development environment setup
This commit is contained in:
parent
0f231bcd9f
commit
b09ea26d66
@ -40,6 +40,15 @@ def query_bookmarks(user: User, query_string: str):
|
|||||||
| Q(url__contains=term)
|
| Q(url__contains=term)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if 'untagged' in query['special_searches']:
|
||||||
|
print(query_set)
|
||||||
|
|
||||||
|
query_set = query_set.filter(
|
||||||
|
tags=None
|
||||||
|
)
|
||||||
|
|
||||||
|
print(query_set)
|
||||||
|
else:
|
||||||
for tag_name in query['tag_names']:
|
for tag_name in query['tag_names']:
|
||||||
query_set = query_set.filter(
|
query_set = query_set.filter(
|
||||||
tags__name__iexact=tag_name
|
tags__name__iexact=tag_name
|
||||||
@ -94,11 +103,14 @@ def _parse_query_string(query_string):
|
|||||||
keywords = query_string.strip().split(' ')
|
keywords = query_string.strip().split(' ')
|
||||||
keywords = [word for word in keywords if word]
|
keywords = [word for word in keywords if word]
|
||||||
|
|
||||||
search_terms = [word for word in keywords if word[0] != '#']
|
search_terms = [word for word in keywords if (word[0] != '#' and word[0] != "!")]
|
||||||
tag_names = [word[1:] for word in keywords if word[0] == '#']
|
tag_names = [word[1:] for word in keywords if word[0] == '#']
|
||||||
tag_names = unique(tag_names, str.lower)
|
tag_names = unique(tag_names, str.lower)
|
||||||
|
|
||||||
|
special_searches = [word[1:] for word in keywords if word[0] == "!"]
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'search_terms': search_terms,
|
'search_terms': search_terms,
|
||||||
'tag_names': tag_names,
|
'tag_names': tag_names,
|
||||||
|
'special_searches': special_searches
|
||||||
}
|
}
|
||||||
|
@ -20,4 +20,6 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</p>
|
</p>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
<hr />
|
||||||
|
<a href="?q=!untagged">Untagged</a>
|
||||||
</div>
|
</div>
|
||||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "linkding",
|
"name": "linkding",
|
||||||
"version": "1.0.0",
|
"version": "1.1.1",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
Loading…
Reference in New Issue
Block a user