allow filtering out some document types
This commit is contained in:
parent
850170aa7c
commit
9abaa2c3e8
|
@ -196,6 +196,7 @@ TABELLIO_DOCUMENT_TYPES = {
|
|||
'texte-adopte-en-commission': 'TEXTCOM',
|
||||
}
|
||||
|
||||
TABELLIO_FILTERED_TYPES = ['BTR']
|
||||
|
||||
local_settings_file = os.environ.get(
|
||||
'PFWB_ARCHIVES_PROXY_SETTINGS_FILE', os.path.join(os.path.dirname(__file__), 'local_settings.py')
|
||||
|
|
|
@ -31,6 +31,9 @@ def redirect(request, sess, no=None, nodoc=None, anx=None, doctype=None, date=No
|
|||
if date:
|
||||
query += ' AND date = %(date)s'
|
||||
|
||||
if settings.TABELLIO_FILTERED_TYPES:
|
||||
query += ' AND type NOT IN %(filtered_types)s'
|
||||
|
||||
cur.execute(
|
||||
query,
|
||||
{
|
||||
|
@ -40,6 +43,7 @@ def redirect(request, sess, no=None, nodoc=None, anx=None, doctype=None, date=No
|
|||
'anx': anx,
|
||||
'doctype': doctype,
|
||||
'date': date,
|
||||
'filtered_types': tuple(settings.TABELLIO_FILTERED_TYPES or []),
|
||||
},
|
||||
)
|
||||
rows = cur.fetchall()
|
||||
|
|
Loading…
Reference in New Issue