]> git.parisson.com Git - diggersdigest.git/commitdiff
Update models
authorThomas Fillon <thomas@parisson.com>
Tue, 25 Aug 2015 15:04:35 +0000 (17:04 +0200)
committerThomas Fillon <thomas@parisson.com>
Tue, 25 Aug 2015 15:04:35 +0000 (17:04 +0200)
diggersdigest/diggersdigest/local_settings.py
diggersdigest/records/migrations/0006_auto_20150825_1452.py [new file with mode: 0644]
diggersdigest/records/models.py

index cff3f92288353fd1a108271c92ca784a49c0bbc9..0f2eb26816c56dd471bfd1a518c135b577b32755 100644 (file)
@@ -16,7 +16,9 @@ DATABASES = {
     }
 }
 
-# FileBrowser settings
+#######################
+# FILEBROWSER settings
+#######################
 #
 # Max. Upload Size in Bytes:
 # 10MB - 10485760
@@ -27,6 +29,27 @@ DATABASES = {
 # 500MB - 429916160
 FILEBROWSER_MAX_UPLOAD_SIZE = 104857600
 
+# EXTENSIONS AND FORMATS
+# Allowed Extensions for File Upload. Lower case is important.
+FILEBROWSER_EXTENSIONS = {
+    'Folder': [''],
+    'Image': ['.jpg', '.jpeg', '.gif', '.png', '.tif', '.tiff'],
+    'Document': ['.pdf', '.doc', '.rtf', '.txt', '.xls', '.csv', '.docx'],
+    'Video': ['.mov', '.wmv', '.mpeg', '.mpg', '.avi', '.rm'],
+    'Audio': ['.mp3', '.mp4', '.wav', '.aiff', '.midi', '.m4p']
+    }
+# Define different formats for allowed selections.
+# This has to be a subset of EXTENSIONS.
+# e.g., add ?type=image to the browse-URL ...
+FILEBROWSER_SELECT_FORMATS = {
+    'file': ['Folder', 'Image', 'Document', 'Video', 'Audio'],
+    'image': ['Image'],
+    'document': ['Document'],
+    'media': ['Video', 'Audio'],
+    'audio': ['Audio'],
+    }
+
+
 ###################
 # DEPLOY SETTINGS #
 ###################
diff --git a/diggersdigest/records/migrations/0006_auto_20150825_1452.py b/diggersdigest/records/migrations/0006_auto_20150825_1452.py
new file mode 100644 (file)
index 0000000..547f70d
--- /dev/null
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('records', '0005_auto_20150824_1547'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='record',
+            name='new',
+            field=models.IntegerField(default=1, choices=[(0, ''), (1, 'New'), (2, 'On Hold'), (3, 'Just Sold')]),
+        ),
+    ]
index 13bd507b40fd13955e355a7329909239e9a90ef1..e5d962e47831ae1870101c582e0ca3abcffa29d8 100644 (file)
@@ -184,16 +184,26 @@ class Record(Product):
     # categories --> shop.theme
     # price --> shop.prix
     # status --> shop.published
-    
+    NEW = 1
+    ON_HOLD = 2 
+    JUST_SOLD = 3
+    NOVELTY_CHOICES = (
+        (0, ''),
+        (NEW, 'New'),
+        (ON_HOLD, 'On Hold'),
+        (JUST_SOLD, 'Just Sold')
+    )
+    #GRADINGS_CHOICES = ()
+     
     artist = models.ForeignKey(Artist)
-    new = models.IntegerField()
+    new = models.IntegerField(choices=NOVELTY_CHOICES, default=NEW)
     label = models.ForeignKey(Label)
     date = models.CharField(max_length=8)
     country = models.ForeignKey(Country)
     desc = models.TextField()
     cover = models.IntegerField()  # TODO : choices=GRADINGS)
     vinyl = models.IntegerField()  # TODO : choices=GRADING)
-    audio =  FileField(_("Audio File"), max_length=200, format="media",
+    audio =  FileField(_("Audio File"), max_length=200, format="audio",
                         upload_to=upload_to("records.Record.audio", "audio/records"))
 
     def __unicode__(self):
@@ -201,5 +211,5 @@ class Record(Product):
 
 
 class Podcast(BlogPost):
-    audio =  FileField(verbose_name=_("Audio File"), max_length=200, format="media",
+    audio =  FileField(verbose_name=_("Audio File"), max_length=200, format="audio",
                        upload_to=upload_to("records.Podcast.audio", "audio/mixes"))