1. Matthew Schinckel
  2. django-sms-gateway

Commits

Matthew Schinckel  committed 1ad47ce

Reply must have a date.

  • Participants
  • Parent commits f201847
  • Branches default

Comments (0)

Files changed (1)

File sms/views.py

View file
         
     logging.debug("Found message %i" % msg.pk)
     gateway = msg.gateway
-    reply = msg.replies.create(
-        content=data.get(gateway.reply_content),
-    )
     if gateway.reply_date_format:
-        reply.date = datetime.datetime.strptime(
+        reply_date = datetime.datetime.strptime(
             data.get(gateway.reply_date),
             gateway.reply_date_format,
         )
     else:
-        reply.date = datetime.datetime.fromtimestamp(float(
+        reply_date = datetime.datetime.fromtimestamp(float(
             data.get(gateway.reply_date)
         ))
+        
+    reply = msg.replies.create(
+        content=data.get(gateway.reply_content),
+        date=reply_date,
+    )
+    logging.debug("Reply created")
+
     logging.debug("Message content was: %s" % reply.content)
     
     if msg.reply_callback: