Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added 'tipologia_bando_label' metadata. #20

Merged
merged 4 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/HISTORY.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Changelog
1.4.5 (unreleased)
------------------

- Nothing changed yet.
- Added "tipologia_bando_label" metadata.
[daniele]


1.4.4 (2024-02-20)
Expand Down
1 change: 1 addition & 0 deletions redturtle/bandi/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,6 @@
<adapter name="scadenza_bando" factory=".indexer.scadenza_bando" />
<adapter name="ente_bando" factory=".indexer.ente_bando" />
<adapter name="tipologia_bando" factory=".indexer.tipologia_bando" />
<adapter name="tipologia_bando_label" factory=".indexer.tipologia_bando_label" />
<adapter name="apertura_bando" factory=".indexer.apertura_bando" />
</configure>
9 changes: 9 additions & 0 deletions redturtle/bandi/indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from DateTime import DateTime
from plone.indexer.decorator import indexer
from redturtle.bandi.interfaces.bando import IBando
from redturtle.bandi.vocabularies import TipologiaBandoVocabulary

# importo il datetime di python
from datetime import datetime
Expand Down Expand Up @@ -63,3 +64,11 @@ def ente_bando(object, **kw):
@indexer(IBando)
def tipologia_bando(object, **kw):
return getattr(object, "tipologia_bando", None)


@indexer(IBando)
def tipologia_bando_label(object, **kw):
if not object.tipologia_bando:
return None
vocab = TipologiaBandoVocabulary().__call__(object)
return vocab.getTermByToken(object.tipologia_bando).title
cekk marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions redturtle/bandi/profiles/default/catalog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@
<column value="destinatari_bando"/>
<column value="scadenza_bando"/>
<column value="tipologia_bando"/>
<column value="tipologia_bando_label"/>
</object>
Loading