diff apps/bundle/models.py @ 209:4033ebe1867f

Add ability to download files This makes use of a new model (BundleVersion) to keep track of the locations on disk of the original uploads for each version. This will require some manual processing to get it working for existing bundles, since the information needed isn't being stored at the moment.
author dellsystem <ilostwaldo@gmail.com>
date Sun, 17 Feb 2013 14:57:39 -0500
parents 1eb652aa501a
children
line wrap: on
line diff
--- a/apps/bundle/models.py	Sat Oct 27 16:26:54 2012 -0400
+++ b/apps/bundle/models.py	Sun Feb 17 14:57:39 2013 -0500
@@ -53,6 +53,20 @@
             "%d_%d" % (self.id, self.latest_version))
 
 
+class BundleVersion(models.Model):
+    class Meta:
+        unique_together = ('bundle', 'version')
+    """
+    Needed to allow users to download the originally-uploaded files
+    """
+    bundle = models.ForeignKey(Bundle)
+    version = models.IntegerField()
+    file_name = models.CharField(max_length=256)
+
+    def __unicode__(self):
+        return self.file_name
+
+
 class BundleFile(MPTTModel):
     bundle = models.ForeignKey(Bundle)
     version = models.IntegerField()