This repository has been archived on 2026-10-10. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
smugfolio-server/smugfolioapi/models/images.py
T
2022-03-20 17:49:44 -05:00

23 lines
966 B
Python

from django.db import models
class Images(models.Model):
album_id = models.IntegerField(default=0)
smug_user = models.ForeignKey("Smug_Users", on_delete=models.CASCADE)
upload_date = models.DateTimeField(auto_now_add=True)
file_name = models
picture = models.ImageField(
upload_to='smugimages', height_field=None,
width_field=None, max_length=None, null=True
)
# picture key in the table is storing the file path, not the binary data, so I don't have worry about space constraints with the 100 character limit.
# @property
# def imagecount(self):
# return self.__imagecount
# @imagecount.setter
# def imagecount(self, value):
# self.__imagecount = value
# I believe that auto_now_add is the correct syntax. If I'm understanding this correctly, it only creates a timestamp when the object is first created.
# https://www.geeksforgeeks.org/datetimefield-django-models/