Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Passing off

  • Loading branch information...
commit fd4ade8731fc8f107d73648f8e1bc688dec42563 1 parent 6456435
Sam Karp authored
View
2  geocamTalk/models.py
@@ -37,7 +37,7 @@ class TalkMessage(GeocamMessage):
"""
#TODO - add time to filename location
- audio_file = models.FileField(null=True, blank=True, upload_to='geocamTalk/audio') #"%s-audio" % (GeocamMessage.author))
+ audio_file = models.FileField(null=True, blank=True, upload_to='geocamTalk/audio/%Y/%m/%d') #"%s-audio" % (GeocamMessage.author))
def __unicode__(self):
try:
View
2  geocamTalk/templates/geocamTalk/message_list.html
@@ -45,7 +45,7 @@
{% if m.has_geolocation %}<img src="/resources/map.png" />{%endif%}
{% if m.has_audio %}
<audio controls="controls">
- <source src={{ m.audio_file.url }} >
+ <source src={{ m.audio_file.filename }} >
</audio>
{%endif%}
</dt>
View
2  geocamTalk/views.py
@@ -117,7 +117,7 @@ def create_message_json(request):
message = TalkMessage.fromJson(messageDict)
if "audio" in request.FILES:
- filename = request.FILES['audio'].name
+ filename = "%s%s.mp4" % (message.author, message.content_timestamp.strftime("%H%M%S"))
file_content = ContentFile(request.FILES['audio'].read())
file_format = os.path.splitext( request.FILES['audio'].name)[-1]
message.audio_file.save(filename, file_content)
Please sign in to comment.
Something went wrong with that request. Please try again.