From 5ed6498257050cd936dd4778b0cc71004dcef40b Mon Sep 17 00:00:00 2001 From: Karsten Hopp Date: Jul 31 2018 08:14:44 +0000 Subject: add date custom field --- diff --git a/pagure/lib/__init__.py b/pagure/lib/__init__.py index 4804a16..2ab06ee 100644 --- a/pagure/lib/__init__.py +++ b/pagure/lib/__init__.py @@ -4448,7 +4448,7 @@ def save_report(session, repo, name, url, username): def set_custom_key_fields( session, project, fields, types, data, notify=None): """ Set or update the custom key fields of a project with the values - provided. "data" is currently only used for lists + provided. "data" is currently only used for lists and dates """ current_keys = {} @@ -4456,15 +4456,20 @@ def set_custom_key_fields( current_keys[key.name] = key for idx, key in enumerate(fields): - if types[idx] != "list": - # Only Lists use data, strip it otherwise - data[idx] = None - else: + if types[idx] == "list": if data[idx]: data[idx] = [ item.strip() for item in data[idx].split(',') ] + elif types[idx] == "date": + if data[idx]: + data[idx] = [ + data[idx].strip() + ] + else: + # Only Lists and dates use data, strip it otherwise + data[idx] = None if notify and notify[idx] == "on": notify_flag = True diff --git a/pagure/templates/settings.html b/pagure/templates/settings.html index cdb8bf5..46eba79 100644 --- a/pagure/templates/settings.html +++ b/pagure/templates/settings.html @@ -883,16 +883,15 @@ value="" class="form-control"/>
- +
-
- +
@@ -908,7 +907,7 @@ value="{{ field.name }}" class="form-control"/>
- @@ -921,11 +920,22 @@ +
- + {% elif field.key_type == 'date' %} + + {% else %} + + {% endif %}
+