stefanfoulis/django-sendsms-admin — pull request #1 by muelli (2013-12-08 23:00:50+00:00)
Title: Added management commands: smslist and smsdelete

This allows for reading and deleting SMS through manage.py.
If you use this SMS backend you might want to delete messages every so
often. Or you might want to retrieve a list of unsent sms, send them
using whatever technology you have, and then delete those messages.

Now you can do something like this:

$ python manage.py smslist
{"body": "hallo", "from": "+234", "sent_at": "2013-12-08T20:22:15.675050+00:00", "flash": false, "to": "+3423423", "id": 1}
{"body": "body test", "from": "234", "sent_at": "2013-12-08T22:33:12.257608+00:00", "flash": false, "to": "2342", "id": 3}
{"body": "Unset message", "from": "234", "sent_at": null, "flash": false, "to": "2342", "id": 5}

$ python manage.py smslist -v 3
Trying to print 0 message(s): ()
{"body": "hallo", "from": "+234", "sent_at": "2013-12-08T20:22:15.675050+00:00", "flash": false, "to": "+3423423", "id": 1}
{"body": "body test", "from": "234", "sent_at": "2013-12-08T22:33:12.257608+00:00", "flash": false, "to": "2342", "id": 3}
{"body": "Unset message", "from": "234", "sent_at": null, "flash": false, "to": "2342", "id": 5}
Finished writing 3 messages

$ python manage.py smslist -v 3 1 5 9
Trying to print 3 message(s): ('1', '5', '9')
{"body": "hallo", "from": "+234", "sent_at": "2013-12-08T20:22:15.675050+00:00", "flash": false, "to": "+3423423", "id": 1}
{"body": "Unset message", "from": "234", "sent_at": null, "flash": false, "to": "2342", "id": 5}
Finished writing 2 messages

$ python manage.py smslist --not-sent 1 5 9
{"body": "Unset message", "from": "234", "sent_at": null, "flash": false, "to": "2342", "id": 5}

$ python manage.py smsdelete -v 3 1 5 9
About to delete 3 message(s): ('1', '5', '9')
Deleting message 1
Message: Message (from: +234; To: +3423423): hallo
Deleting message 5
Message: Message (from: 234; To: 2342): Unset message
Message with ID 9 does not exist
Finished deleting 2 messages

$ python manage.py smslist
{"body": "body test", "from": "234", "sent_at": "2013-12-08T22:33:12.257608+00:00", "flash": false, "to": "2342", "id": 3}