WhisperMaPhone/main/models.py

20 lines
660 B
Python
Raw Normal View History

2021-04-28 02:47:33 +00:00
import os
2020-11-22 00:05:31 +00:00
import uuid
2020-09-06 03:12:54 +00:00
from django.db import models
class Thought(models.Model):
text = models.CharField(max_length=140)
extended_text = models.TextField(blank=True)
2020-11-22 00:05:31 +00:00
uuid = models.UUIDField(default=uuid.uuid4, editable=False)
posted = models.DateTimeField(auto_now_add=True)
2020-09-06 03:12:54 +00:00
timezone_offset = models.IntegerField() # The number of minutes behind UTC we were when this was posted
media = models.FileField(upload_to="", blank=True) # A single image, video, or sound clip per post
2021-04-28 02:47:33 +00:00
def get_media_type(self):
if not self.media:
return ""
else:
return os.path.splitext(self.media.path)[1][1:]