From 814fefaaa5366153230f61a580e447e88c101a59 Mon Sep 17 00:00:00 2001 From: yomguy Date: Mon, 20 Feb 2012 11:42:57 +0100 Subject: [PATCH] add south migrations, add Record --- telecaster/migrations/0001_initial.pyc | Bin 0 -> 5273 bytes ...tion__chg_field_department_description_.py | 117 ++++++++++++++++++ ...ion__chg_field_department_description_.pyc | Bin 0 -> 4633 bytes .../migrations/0003_auto__add_record.py | 82 ++++++++++++ .../migrations/0003_auto__add_record.pyc | Bin 0 -> 4043 bytes telecaster/migrations/__init__.pyc | Bin 0 -> 160 bytes telecaster/models.py | 69 ++++++----- 7 files changed, 238 insertions(+), 30 deletions(-) create mode 100644 telecaster/migrations/0001_initial.pyc create mode 100644 telecaster/migrations/0002_auto__chg_field_session_description__chg_field_department_description_.py create mode 100644 telecaster/migrations/0002_auto__chg_field_session_description__chg_field_department_description_.pyc create mode 100644 telecaster/migrations/0003_auto__add_record.py create mode 100644 telecaster/migrations/0003_auto__add_record.pyc create mode 100644 telecaster/migrations/__init__.pyc diff --git a/telecaster/migrations/0001_initial.pyc b/telecaster/migrations/0001_initial.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ea4abad2c99b8b2d96ca925098dbfbcc424b83b7 GIT binary patch literal 5273 zcmcgw>2ecC5T4cL3mbzm#uyAX7>P?hz|L6-0g6g0g_9b)QWYmD)ml4}7O!@doe_Z) z|C~Hk9wEQ-DtQ6&^^Eq=$`&SpSlZFdbWh*i)9b(fo*e)E=RddWtoJv9-v@Z)cNiRe zEq1`zo|)&^fyKNW+siSFV0m_sXI_Er70kN84vNexvAq)3MJ5WYVKJw~eq-#AvG4ar zh}=$vc(||ew_UL?RXJj{Z|0{l->J7m+kWacLtD9lZvZ6#+JPfHsm3skp?#7+1VsLk zXG}n5ux7*>(t<5b@~l;2ts-jygv~tLate5gtjSml8ztt9U_Hv5F}BsnGiMyDi3oa% zIg?mVG3T^_PGfaOLqQMQXU+CZd)k?zfMk-)>aa0Cw9D@}TgE!+Cyanj(!9#b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U7~LRXD(j$qQq2PF#GzD>-?Kz;C2!ti!|wiQ8!_jE%bnm2QT;*g8?{rdDs{!(D+s zC%?vNlR+KGUO}Ab8?r_QsBj&tC{*?a(XV9^1 literal 0 HcmV?d00001 diff --git a/telecaster/migrations/__init__.pyc b/telecaster/migrations/__init__.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d1996b8349de3ba235dc3fd0d0dfa346b9ebc682 GIT binary patch literal 160 zcmcckiI=Oj@U&kt0~9at+UzIO literal 0 HcmV?d00001 diff --git a/telecaster/models.py b/telecaster/models.py index 2b337a7..cea73b6 100644 --- a/telecaster/models.py +++ b/telecaster/models.py @@ -46,6 +46,7 @@ from tools import * from mutagen.oggvorbis import OggVorbis from mutagen.id3 import ID3, TIT2, TP1, TAL, TDA, TDAT, TDRC, TCO, COM +import django.db.models as models from django.db.models import * from django.forms import ModelForm from django.utils.translation import ugettext_lazy as _ @@ -54,56 +55,56 @@ app_label = 'telecaster' class Organization(Model): - + name = CharField(_('name'), max_length=255) description = CharField(_('description'), max_length=255, blank=True) - + def __str__(self): return self.name - + class Meta: db_table = app_label + '_' + 'organization' class Department(Model): - + name = CharField(_('name'), max_length=255) description = CharField(_('description'), max_length=255, blank=True) def __str__(self): return self.name - + class Meta: db_table = app_label + '_' + 'department' class Conference(Model): - + title = CharField(_('title'), max_length=255) description = CharField(_('description'), max_length=255, blank=True) department = ForeignKey('Department', related_name='conferences', verbose_name='department') - + def __str__(self): return self.title - + class Meta: db_table = app_label + '_' + 'conference' class Session(Model): - + name = CharField(_('name'), max_length=255) description = CharField(_('description'), max_length=255, blank=True) number = IntegerField(_('number')) - + def __str__(self): return self.name - + class Meta: db_table = app_label + '_' + 'session' class Professor(Model): - + name = CharField(_('name'), max_length=255) institution = CharField(_('institution'), max_length=255, blank=True) address = CharField(_('address'), max_length=255, blank=True) @@ -112,29 +113,29 @@ class Professor(Model): def __str__(self): return self.name - + class Meta: db_table = app_label + '_' + 'professor' - - + + class Station(Model): - - organization = ForeignKey('Organization', related_name='stations', verbose_name='organization') - department = ForeignKey('Department', related_name='stations', verbose_name='department') - conference = ForeignKey('Conference', related_name='stations', verbose_name='conference') - session = ForeignKey('Session', related_name='stations', verbose_name='session') - professor = ForeignKey('Professor', related_name='stations', verbose_name='professor') + + organization = ForeignKey(Organization, related_name='stations', verbose_name='organization') + department = ForeignKey(Department, related_name='stations', verbose_name='department') + conference = ForeignKey(Conference, related_name='stations', verbose_name='conference') + session = ForeignKey(Session, related_name='stations', verbose_name='session') + professor = ForeignKey(Professor, related_name='stations', verbose_name='professor') comment = TextField(_('comment'), blank=True) started = BooleanField(_('started')) - datetime_start = DateTimeField(_('time_start'), blank=True) - datetime_stop = DateTimeField(_('time_stop'), blank=True) + datetime_start = DateTimeField(_('time_start'), blank=True, null=True) + datetime_stop = DateTimeField(_('time_stop'), blank=True, null=True) class Meta: db_table = app_label + '_' + 'station' - + def __str__(self): return ' - '.join(self.description) + ' - ' + str(self.datetime_start) + ' > ' + str(self.datetime_stop) - + def to_dict(self): dict = [ {'id':'organization','value': self.organization.name, 'class':'', 'label':'Organization'}, {'id': 'department', 'value': self.department.name , 'class':'', 'label':'Departement'}, @@ -145,14 +146,14 @@ class Station(Model): {'id': 'started', 'value': str(self.started), 'class':'' , 'label': 'Started'}, ] return dict - + @property def description(self): return [self.organization.name, self.conference.department.name, self.conference.title, self.session.name, self.professor.name, self.comment] - + def set_conf(self, conf): self.conf = conf - + def setup(self): self.date = datetime.datetime.now().strftime("%Y") self.time = datetime.datetime.now().strftime("%x-%X") @@ -198,7 +199,7 @@ class Station(Model): self.deefuzzer_dict = xml2dict(self.deefuzzer_default_conf_file) self.deefuzzer_osc_ports = [] self.server_ports = [] - + for station in self.deefuzzer_dict['deefuzzer']['station']: if station['control']['mode'] == '1': self.deefuzzer_osc_ports.append(station['control']['port']) @@ -222,7 +223,7 @@ class Station(Model): station['relay']['mode'] = '1' station['relay']['author'] = self.professor self.deefuzzer_dict['deefuzzer']['station'][i] = station - i += 1 + i += 1 self.deefuzzer_xml = dicttoxml(self.deefuzzer_dict) def deefuzzer_write_conf(self): @@ -305,3 +306,11 @@ class Station(Model): self.deefuzzer_stop() self.del_lock() + +class Record(Model): + + station = ForeignKey(Station, related_name='records', verbose_name='station', + blank=True, null=True, on_delete=models.SET_NULL) + datetime = DateTimeField(_('record_date'), auto_now=True) + file = FileField(_('file'), upload_to='items/%Y/%m/%d') + -- 2.39.5