comparison user_photos/models.py @ 749:b6e98717690b

For #59, add user photo de-duplication for uploads.
author Brian Neal <bgneal@gmail.com>
date Mon, 30 Dec 2013 15:05:43 -0600
parents b2a8fde3173a
children
comparison
equal deleted inserted replaced
748:e5869846d0dc 749:b6e98717690b
12 user = models.ForeignKey(settings.AUTH_USER_MODEL, 12 user = models.ForeignKey(settings.AUTH_USER_MODEL,
13 related_name='uploaded_photos') 13 related_name='uploaded_photos')
14 upload_date = models.DateTimeField() 14 upload_date = models.DateTimeField()
15 url = models.URLField(max_length=200) 15 url = models.URLField(max_length=200)
16 thumb_url = models.URLField(max_length=200, blank=True) 16 thumb_url = models.URLField(max_length=200, blank=True)
17 signature = models.CharField(max_length=32, blank=True, db_index=True)
17 18
18 def __unicode__(self): 19 def __unicode__(self):
19 return u'Photo by {} on {}'.format(self.user.username, 20 return u'Photo by {} on {}'.format(self.user.username,
20 self.upload_date.strftime('%Y-%m-%d %H:%M:%S')) 21 self.upload_date.strftime('%Y-%m-%d %H:%M:%S'))
21 22