from django.db import models
from jsonfield.fields import JSONField
from django.utils.translation import ugettext_lazy as _
from archive.constants import status
from django.db import models
from jsonfield.fields import JSONField
from django.utils.translation import ugettext_lazy as _
from archive.constants import status
-from archive.settings import FILES_PATH, ADVERT, LICENSE, ORGANIZATION, PROJECT
+from archive.settings import FILES_SAVE_PATH, ADVERT, LICENSE, ORGANIZATION, PROJECT
+from archive.utils import OverwriteStorage
- source_file = models.FileField(upload_to='archive/files', verbose_name=_('source file'), editable=False)
+ source_file = models.FileField(upload_to=source_upload_to, max_length=255,
+ verbose_name=_('source file'), editable=False)
source_sha1 = models.CharField(max_length=40, editable=False)
title = models.CharField(max_length=255, verbose_name=_('title'))
source_sha1 = models.CharField(max_length=40, editable=False)
title = models.CharField(max_length=255, verbose_name=_('title'))
mp3_status = models.SmallIntegerField(null=True, editable=False, choices=status.choices)
mp3_task = models.CharField(max_length=64, null=True, editable=False)
mp3_tags = JSONField(null=True, editable=False)
mp3_status = models.SmallIntegerField(null=True, editable=False, choices=status.choices)
mp3_task = models.CharField(max_length=64, null=True, editable=False)
mp3_tags = JSONField(null=True, editable=False)
- mp3_file = models.FileField(null=True, upload_to='archive/final', editable=False)
+ mp3_file = models.FileField(null=True, upload_to='archive/final', storage=OverwriteStorage(), editable=False)
mp3_published_tags = JSONField(null=True, editable=False)
mp3_published = models.DateTimeField(null=True, editable=False)
ogg_status = models.SmallIntegerField(null=True, editable=False, choices=status.choices)
ogg_task = models.CharField(max_length=64, null=True, editable=False)
ogg_tags = JSONField(null=True, editable=False)
mp3_published_tags = JSONField(null=True, editable=False)
mp3_published = models.DateTimeField(null=True, editable=False)
ogg_status = models.SmallIntegerField(null=True, editable=False, choices=status.choices)
ogg_task = models.CharField(max_length=64, null=True, editable=False)
ogg_tags = JSONField(null=True, editable=False)
- ogg_file = models.FileField(null=True, upload_to='archive/final', editable=False)
+ ogg_file = models.FileField(null=True, upload_to='archive/final', storage=OverwriteStorage(), editable=False)
ogg_published_tags = JSONField(null=True, editable=False)
ogg_published = models.DateTimeField(null=True, editable=False)
ogg_published_tags = JSONField(null=True, editable=False)
ogg_published = models.DateTimeField(null=True, editable=False)
'organization': ORGANIZATION,
'title': title,
'flac_sha1': self.source_sha1,
'organization': ORGANIZATION,
'title': title,
'flac_sha1': self.source_sha1,