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)
|
2020-11-24 18:39:36 +00:00
|
|
|
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
|
2021-04-25 17:09:30 +00:00
|
|
|
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:]
|