Skip to content
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.

Commit

Permalink
fix some issues with scheduled messages page
Browse files Browse the repository at this point in the history
  • Loading branch information
monty5811 committed May 1, 2016
1 parent c01bd48 commit 335027b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ansible/env_vars/base.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---

git_repo: https://github.com/monty5811/apostello.git
git_version: v1.7.0
git_version: v1.7.1

project_name: apostello
application_name: apostello
Expand Down
12 changes: 12 additions & 0 deletions api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ class Meta:


class QScheduleSerializer(serializers.ModelSerializer):
"""Serialize scheduled django-q tasks.
Note - this will only work with scheduled message tasks.
"""

next_run = serializers.DateTimeField()
message_body = serializers.SerializerMethodField()
Expand All @@ -182,9 +186,13 @@ def _split_args(sched_args):
return ast.literal_eval(sched_args)

def get_message_body(self, obj):
if obj.args is None:
return None
return self._split_args(obj.args)[1]

def get_recipient(self, obj):
if obj.args is None:
return None
pk = self._split_args(obj.args)[0]
if pk is not None:
grp = Recipient.objects.get(pk=pk)
Expand All @@ -194,6 +202,8 @@ def get_recipient(self, obj):
return {'url': '#', 'full_name': 'n/a'}

def get_recipient_group(self, obj):
if obj.args is None:
return None
grp_name = self._split_args(obj.args)[2]
if grp_name is not None:
grp = RecipientGroup.objects.get(name=grp_name)
Expand All @@ -203,6 +213,8 @@ def get_recipient_group(self, obj):
return {'url': '#', 'name': 'n/a'}

def get_queued_by(self, obj):
if obj.args is None:
return None
return self._split_args(obj.args)[3]

class Meta:
Expand Down
2 changes: 1 addition & 1 deletion api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
model_class=Schedule,
serializer_class=s.QScheduleSerializer,
filter_list=True,
filters={'func__contains': 'send'},
filters={'func__contains': 'send_message'},
permission_classes=(IsAuthenticated, IsStaff)
),
name='q_schedules'
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
copyright = '2015, Dean Montgomery'
author = 'Dean Montgomery'

version = '1.7.0'
version = '1.7.1'
# The full version, including alpha/beta/rc tags.
release = '0.1'
language = None
Expand Down
2 changes: 1 addition & 1 deletion scripts/install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
set -e
AP_VER=v1.7.0
AP_VER=v1.7.1

echo "Installing and upgrading packages"
sudo apt-get update -qq
Expand Down

0 comments on commit 335027b

Please sign in to comment.