areski / django-audiofield

Django-Audiofield is a simple app that allows Audio files upload, management and conversion to different audio format (mp3, wav & ogg), which also makes it easy to play audio files into your Django application.
Other
174 stars 51 forks source link

AudioField does not play nice with django South #4

Closed stevebma closed 10 years ago

stevebma commented 10 years ago

migration fails with an error like:

ValueError: Cannot successfully create field 'X' for model 'Y': 'ext_whitelist'.

This seems to be solved by creating a specific introspection rule for south, this has worked for me (it adds a default argument for ext_whitelist, which is added / not in the baseclass FileField)

from south.modelsinspector import add_introspection_rules add_introspection_rules( [ ( (AudioField, ), [], { "verbose_name": ["verbose_name", {"default": None}], "name": ["name", {"default": None}], "ext_whitelist": ["ext_whitelist", {"default": (".mp3"),}], }, ), ], ["^audiofield.fields.AudioField",])

areski commented 10 years ago

That's also what I do when I use AudioField, in the models importing Audiofile I always add : add_introspection_rules([ ( [AudioField], # Class(es) these apply to [], # Positional arguments (not used) { "ext_whitelist": ["ext_whitelist", {"default": ""}], }, # Keyword argument ), ], ["^audiofield.fields.AudioField"])

Example : https://github.com/Star2Billing/newfies-dialer/blob/master/newfies/survey/models.py#L29

stevebma commented 10 years ago

It would be great if this could be documented, would save people using the app a lot of time :)

2013/11/27 Areski Belaid notifications@github.com

That's also what I do when I use AudioField, in the models importing Audiofile I always add : add_introspection_rules([ ( [AudioField], # Class(es) these apply to [], # Positional arguments (not used) { "ext_whitelist": ["ext_whitelist", {"default": ""}], }, # Keyword argument ), ], ["^audiofield.fields.AudioField"])

Example : https://github.com/Star2Billing/newfies-dialer/blob/master/newfies/survey/models.py#L29

— Reply to this email directly or view it on GitHubhttps://github.com/Star2Billing/django-audiofield/issues/4#issuecomment-29352890 .

areski commented 10 years ago

Could you make a PR for the documentation :)

On Wed, Nov 27, 2013 at 9:32 AM, stevenbouma notifications@github.comwrote:

It would be great if this could be documented, would save people using the app a lot of time :)

2013/11/27 Areski Belaid notifications@github.com

That's also what I do when I use AudioField, in the models importing Audiofile I always add : add_introspection_rules([ ( [AudioField], # Class(es) these apply to [], # Positional arguments (not used) { "ext_whitelist": ["ext_whitelist", {"default": ""}], }, # Keyword argument ), ], ["^audiofield.fields.AudioField"])

Example :

https://github.com/Star2Billing/newfies-dialer/blob/master/newfies/survey/models.py#L29

— Reply to this email directly or view it on GitHub< https://github.com/Star2Billing/django-audiofield/issues/4#issuecomment-29352890>

.

— Reply to this email directly or view it on GitHubhttps://github.com/Star2Billing/django-audiofield/issues/4#issuecomment-29367501 .

Kind regards, /Areski


Arezqui Belaid, areski@gmail.com Founder at Star2Billing (www.star2billing.com)

Tel: +34650784355 Twitter: http://twitter.com/areskib LinkedIn: http://www.linkedin.com/in/areski

areski commented 10 years ago

Closing for no activity