Skip to content

Commit

Permalink
Merge pull request #67 from dahorak/fix-signoff-and-name-label-fields…
Browse files Browse the repository at this point in the history
…-in-pending-and-finished-requests-table

Fix signoff and name label fields in pending and finished requests table
  • Loading branch information
petr-balogh authored Feb 9, 2024
2 parents 97fdc0c + 7c2241d commit 4db084c
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3
FROM python:3.10
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ djangorestframework==3.12.4
Markdown==3.3.4
psycopg2-binary==2.8.6
pytz==2021.1
PyYAML==5.4.1
PyYAML==6.0.1
retry==0.9.2
six==1.15.0
sqlparse==0.4.1
sqlparse==0.4.1
20 changes: 20 additions & 0 deletions rqueue/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,26 @@ def add_to_data_json(self, json_to_add=None, **kwargs):

self.save()

def get_data_value(self, key):
data = dict(json_continuously_loader(self.data))
return data.get(key, "")

@property
def name(self):
return self.get_data_value("name")

@property
def signoff(self):
return self.get_data_value("signoff")

@property
def label(self):
return self.get_data_value("label")

@property
def link(self):
return self.get_data_value("link")

class Meta:
# Here you can put more descriptive to display in Admin
verbose_name_plural = "Requests in Queue"
14 changes: 7 additions & 7 deletions templates/includes/finished_requests_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,19 @@
<!-- Row Description End -->
<!-- Row Label Start -->
<td>
{{ finishedqueue.data.name }}
{{ finishedqueue.data.label }}
<!--{{ finishedqueue.data.labels_string }}-->
{{ finishedqueue.name }}
{{ finishedqueue.label }}
<!--{{ finishedqueue.labels_string }}-->
</td>
<!-- Row Label End -->
<!-- Row Signoff Start -->
<td>
{% if finishedqueue.data.link and finishedqueue.data.link != "None" %}
<a href="{{ finishedqueue.data.link }}">
{{ finishedqueue.data.signoff }}
{% if finishedqueue.link and finishedqueue.link != "None" %}
<a href="{{ finishedqueue.link }}">
{{ finishedqueue.signoff }}
</a>
{% else %}
{{ finishedqueue.data.signoff }}
{{ finishedqueue.signoff }}
{% endif %}
</td>
<!-- Row Signoff End -->
Expand Down
14 changes: 7 additions & 7 deletions templates/includes/pending_requests_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,19 @@
<!-- Row Description End -->
<!-- Row Label Start -->
<td>
{{ rqueue.data.name }}
{{ rqueue.data.label }}
<!--{{ rqueue.data.labels_string }}-->
{{ rqueue.name }}
{{ rqueue.label }}
<!--{{ rqueue.labels_string }}-->
</td>
<!-- Row Label End -->
<!-- Row Signoff Start -->
<td>
{% if rqueue.data.link and rqueue.data.link != "None" %}
<a href="{{ rqueue.data.link }}">
{{ rqueue.data.signoff }}
{% if rqueue.link and rqueue.link != "None" %}
<a href="{{ rqueue.link }}">
{{ rqueue.signoff }}
</a>
{% else %}
{{ rqueue.data.signoff }}
{{ rqueue.signoff }}
{% endif %}
</td>
<!-- Row Signoff End -->
Expand Down

0 comments on commit 4db084c

Please sign in to comment.