Save timestamp field to DB. Add timestamp to the create_testrun page PRODX-35933

Change-Id: I23f66a375775d6d456d252fe0036642d60a50428
diff --git a/testrail_bot/control/forms.py b/testrail_bot/control/forms.py
index e8280a4..cc516ac 100644
--- a/testrail_bot/control/forms.py
+++ b/testrail_bot/control/forms.py
@@ -4,6 +4,10 @@
 
 
 class TestRunForm(forms.ModelForm):
+    def __init__(self, *args, **kwargs):
+        super().__init__(*args, **kwargs)
+        self.fields["timestamp"].widget = forms.SelectDateWidget(years=[
+            date.today().year + i for i in range(-3, 5)])
     class Meta:
         model = TestRailTestRun
         fields = "__all__"
@@ -12,18 +16,15 @@
             "plan_name": "Name of the Test Plan without date",
             "run_name": "Name of the run",
             "run_id": "ID of the run",
-            "created_by_id": "If of the user that created Test Run",
+            "created_by_id": "ID of the user that created Test Run",
             "filter_func": "Custom filter function",
-            "ip_filter": "Change ip to x.x.x.x",
-            "uuid_filter": "Change uuid to xxxx",
+            "ip_filter": "Mask all IP with x.x.x.x",
+            "uuid_filter": "Mask all UUID with xxxx",
             "filter_last_traceback": "Use only last traceback to "
-                                     "compare comments"
+                                     "compare comments",
+            "timestamp": "Date of report to be processed"
         }
         help_texts = {
             "filter_func": "Leave blank if not used",
         }
 
-    timestamp = forms.DateField(
-        label="Date of report to be processed", initial=date.today(),
-        widget=forms.SelectDateWidget(years=[date.today().year + i for i in range(-3, 10)]),
-        required=False)
diff --git a/testrail_bot/control/migrations/0019_testrailtestrun_timestamp_and_more.py b/testrail_bot/control/migrations/0019_testrailtestrun_timestamp_and_more.py
new file mode 100644
index 0000000..998d81d
--- /dev/null
+++ b/testrail_bot/control/migrations/0019_testrailtestrun_timestamp_and_more.py
@@ -0,0 +1,18 @@
+# Generated by Django 4.2.6 on 2023-10-06 11:34
+
+import datetime
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('control', '0018_testrailtestrun_run_id'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='testrailtestrun',
+            name='timestamp',
+            field=models.DateField(default=datetime.date.today()))
+    ]
diff --git a/testrail_bot/control/models.py b/testrail_bot/control/models.py
index 41e46a0..915fc0b 100644
--- a/testrail_bot/control/models.py
+++ b/testrail_bot/control/models.py
@@ -1,5 +1,8 @@
+import datetime
+
 from django.core.files.storage import FileSystemStorage
 from django.db import models
+from django import forms
 
 
 class TestRailTestRun(models.Model):
@@ -12,6 +15,7 @@
     ip_filter = models.BooleanField(default=True)
     uuid_filter = models.BooleanField(default=True)
     filter_last_traceback = models.BooleanField(default=False)
+    timestamp = models.DateField(default=datetime.date.today())
 
 
 fs = FileSystemStorage()
diff --git a/testrail_bot/control/templates/control/create_run.html b/testrail_bot/control/templates/control/create_run.html
index ba25508..fadec4b 100644
--- a/testrail_bot/control/templates/control/create_run.html
+++ b/testrail_bot/control/templates/control/create_run.html
@@ -14,6 +14,9 @@
         User to id list: <ul><li>os-qa-bot = <code>109</code></li></ul>
       </div>
       <div class="col-xs-8">{% bootstrap_field form.filter_func  size='sm' %}</div>
+      <div class="col-xs-8">
+        {% bootstrap_field form.timestamp size='sm' %}
+      </div>
       <div class="col-md-5">
         {% bootstrap_field form.ip_filter  size='sm'%}
       </div>