comparison gpp/potd/models.py @ 182:5c889b587416

Fixing #64. Updating all model save() methods to use *args and **kwargs. Django 1.2 has new keyword arguments.
author Brian Neal <bgneal@gmail.com>
date Sun, 28 Mar 2010 21:41:11 +0000
parents 7b6540b185d9
children 3c951521e0ec
comparison
equal deleted inserted replaced
181:500e5875a306 182:5c889b587416
42 42
43 @models.permalink 43 @models.permalink
44 def get_absolute_url(self): 44 def get_absolute_url(self):
45 return ('potd-archive', [str(self.id)]) 45 return ('potd-archive', [str(self.id)])
46 46
47 def save(self, force_insert=False, force_update=False): 47 def save(self, *args, **kwargs):
48 48
49 if self.thumb: 49 if self.thumb:
50 self.thumb.delete(save=False) 50 self.thumb.delete(save=False)
51 51
52 parser = ImageFile.Parser() 52 parser = ImageFile.Parser()
58 s = StringIO() 58 s = StringIO()
59 image.save(s, format) 59 image.save(s, format)
60 thumb_name = os.path.basename(self.photo.path) 60 thumb_name = os.path.basename(self.photo.path)
61 self.thumb.save(thumb_name, ContentFile(s.getvalue()), save=False) 61 self.thumb.save(thumb_name, ContentFile(s.getvalue()), save=False)
62 62
63 super(Photo, self).save(force_insert, force_update) 63 super(Photo, self).save(*args, **kwargs)
64 Sequence.objects.insert_photo(self.pk) 64 Sequence.objects.insert_photo(self.pk)
65 65
66 def delete(self): 66 def delete(self):
67 Sequence.objects.remove_photo(self.pk) 67 Sequence.objects.remove_photo(self.pk)
68 super(Photo, self).delete() 68 super(Photo, self).delete()