From: Thomas Fillon Date: Tue, 25 Aug 2015 15:04:35 +0000 (+0200) Subject: Update models X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=2abcaef08161e2dc28245faa5bc2d898dfd611a7;p=diggersdigest.git Update models --- diff --git a/diggersdigest/diggersdigest/local_settings.py b/diggersdigest/diggersdigest/local_settings.py index cff3f92..0f2eb26 100644 --- a/diggersdigest/diggersdigest/local_settings.py +++ b/diggersdigest/diggersdigest/local_settings.py @@ -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 index 0000000..547f70d --- /dev/null +++ b/diggersdigest/records/migrations/0006_auto_20150825_1452.py @@ -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')]), + ), + ] diff --git a/diggersdigest/records/models.py b/diggersdigest/records/models.py index 13bd507..e5d962e 100644 --- a/diggersdigest/records/models.py +++ b/diggersdigest/records/models.py @@ -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"))