Ticket #593: product_models.patch
| File product_models.patch, 1.3 kB (added by mengkuan, 3 months ago) |
|---|
-
satchmo/product/models.py
old new 10 10 import random 11 11 import sha 12 12 import signals 13 import os 13 14 14 15 from django.conf import settings 15 16 from django.contrib.sites.models import Site … … 1113 1114 def _protected_dir(instance, filename): 1114 1115 raw = config_value_safe('PRODUCT', 'PROTECTED_DIR', 'images/') 1115 1116 updir = normalize_dir(raw) 1116 return updir1117 return "%s/%s" % (updir, os.path.basename(filename)) 1117 1118 1118 1119 class DownloadableProduct(models.Model): 1119 1120 """ 1120 1121 This type of Product is a file to be downloaded 1121 1122 """ 1122 1123 product = models.OneToOneField(Product, verbose_name=_("Product"), primary_key=True) 1123 file = FileField(_("File"), upload_to=_protected_dir) ,1124 file = FileField(_("File"), upload_to=_protected_dir) 1124 1125 num_allowed_downloads = models.IntegerField(_("Num allowed downloads"), help_text=_("Number of times link can be accessed.")) 1125 1126 expire_minutes = models.IntegerField(_("Expire minutes"), help_text=_("Number of minutes the link should remain active.")) 1126 1127 active = models.BooleanField(_("Active"), help_text=_("Is this download currently active?"), default=True)
