Commit 653aca2d authored by fred's avatar fred

add models for track data

parent 51cd8c2b
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Album'
db.create_table(u'nonstop_album', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
))
db.send_create_signal(u'nonstop', ['Album'])
# Adding model 'Artist'
db.create_table(u'nonstop_artist', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
))
db.send_create_signal(u'nonstop', ['Artist'])
# Adding model 'Track'
db.create_table(u'nonstop_track', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('title', self.gf('django.db.models.fields.CharField')(max_length=255)),
('artist', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['nonstop.Artist'], null=True)),
('album', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['nonstop.Album'], null=True)),
('instru', self.gf('django.db.models.fields.BooleanField')(default=False)),
('language', self.gf('django.db.models.fields.CharField')(max_length=3, blank=True)),
('sabam', self.gf('django.db.models.fields.BooleanField')(default=True)),
))
db.send_create_signal(u'nonstop', ['Track'])
# Adding field 'NonstopFile.track'
db.add_column(u'nonstop_nonstopfile', 'track',
self.gf('django.db.models.fields.related.ForeignKey')(to=orm['nonstop.Track'], null=True),
keep_default=False)
def backwards(self, orm):
# Deleting model 'Album'
db.delete_table(u'nonstop_album')
# Deleting model 'Artist'
db.delete_table(u'nonstop_artist')
# Deleting model 'Track'
db.delete_table(u'nonstop_track')
# Deleting field 'NonstopFile.track'
db.delete_column(u'nonstop_nonstopfile', 'track_id')
models = {
u'nonstop.album': {
'Meta': {'object_name': 'Album'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '255'})
},
u'nonstop.artist': {
'Meta': {'object_name': 'Artist'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '255'})
},
u'nonstop.nonstopfile': {
'Meta': {'object_name': 'NonstopFile'},
'creation_timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}),
'filepath': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'track': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['nonstop.Track']", 'null': 'True'})
},
u'nonstop.somalogline': {
'Meta': {'ordering': "['play_timestamp']", 'object_name': 'SomaLogLine'},
'filepath': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['nonstop.NonstopFile']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'play_timestamp': ('django.db.models.fields.DateTimeField', [], {})
},
u'nonstop.track': {
'Meta': {'object_name': 'Track'},
'album': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['nonstop.Album']", 'null': 'True'}),
'artist': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['nonstop.Artist']", 'null': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'instru': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'language': ('django.db.models.fields.CharField', [], {'max_length': '3', 'blank': 'True'}),
'sabam': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
}
}
complete_apps = ['nonstop']
\ No newline at end of file
......@@ -2,9 +2,34 @@ from django.db import models
from django.utils.translation import ugettext_lazy as _
class Artist(models.Model):
name = models.CharField(_('Name'), max_length=255)
class Album(models.Model):
name = models.CharField(_('Name'), max_length=255)
LANGUAGES = [
('en', _('English')),
('fr', _('French')),
('nl', _('Dutch'))
]
class Track(models.Model):
title = models.CharField(_('Title'), max_length=255)
artist = models.ForeignKey(Artist, null=True)
album = models.ForeignKey(Album, null=True)
instru = models.BooleanField(_('Instru'), default=False)
language = models.CharField(max_length=3,
choices=LANGUAGES, blank=True)
sabam = models.BooleanField('SABAM', default=True)
class NonstopFile(models.Model):
filepath = models.CharField(_('Filepath'), max_length=255)
creation_timestamp = models.DateTimeField(auto_now_add=True, null=True)
track = models.ForeignKey(Track, null=True)
class SomaLogLine(models.Model):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment