forked from GeoNode/geonode
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves GeoNode#6925: change metadata template to let it reads the n…
…ew thesaurus information as template tags, add tests for new template tags
- Loading branch information
1 parent
f409342
commit f2f433e
Showing
6 changed files
with
130 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from django import template | ||
from geonode.base.models import Thesaurus, ThesaurusKeywordLabel | ||
from django.conf import settings | ||
|
||
register = template.Library() | ||
|
||
|
||
@register.filter | ||
def get_unique_thesaurus_set(thesaurus_from_keyword): | ||
return set(thesaurus_from_keyword.values_list('thesaurus', flat=True)) | ||
|
||
@register.filter | ||
def get_keyword_label(keyword): | ||
lang = 'en' if not hasattr(settings, 'THESAURUS_DEFAULT_LANG') else settings.THESAURUS_DEFAULT_LANG | ||
return ThesaurusKeywordLabel.objects.filter(keyword=keyword).filter(lang=lang).first().label | ||
|
||
@register.filter | ||
def get_thesaurus_title(thesaurus_id): | ||
return Thesaurus.objects.get(id=thesaurus_id).title | ||
|
||
@register.filter | ||
def get_thesaurus_date(thesaurus_id): | ||
return Thesaurus.objects.get(id=thesaurus_id).date |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Generated by Django 2.2.16 on 2021-02-05 08:24 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('people', '0030_auto_20210118_1112'), | ||
('people', '0030_auto_20210201_0953'), | ||
] | ||
|
||
operations = [ | ||
] |