From 9b924cbc40dab19cf34d4560fbafd5a4eef6bd9b Mon Sep 17 00:00:00 2001 From: Sergey Fursov Date: Sun, 29 Dec 2013 14:57:25 +0400 Subject: [PATCH 1/3] fixed tested url There is can be any url prefix, using reverse for checking absolute url --- schedule/tests/test_event.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/schedule/tests/test_event.py b/schedule/tests/test_event.py index d88725a2..88b9d8fd 100644 --- a/schedule/tests/test_event.py +++ b/schedule/tests/test_event.py @@ -1,5 +1,6 @@ import datetime from django.conf import settings +from django.core.urlresolvers import reverse from django.test.utils import override_settings import pytz @@ -297,7 +298,7 @@ def test_get_absolute(self): cal) event.save() url = event.get_absolute_url() - self.assertEquals('/event/1/', url) + self.assertEquals(reverse('event', kwargs={'event_id': event.id}), url) def test_(self): pass From 88c1fe437afe128c2b3461f015fec2ee0f5f6792 Mon Sep 17 00:00:00 2001 From: Sergey Fursov Date: Sun, 29 Dec 2013 14:57:56 +0400 Subject: [PATCH 2/3] using south for migrations --- project_sample/settings.py | 3 +- schedule/migrations/0001_initial.py | 195 ++++++++++++++++++++++++++++ schedule/migrations/__init__.py | 0 3 files changed, 197 insertions(+), 1 deletion(-) create mode 100644 schedule/migrations/0001_initial.py create mode 100644 schedule/migrations/__init__.py diff --git a/project_sample/settings.py b/project_sample/settings.py index 8f230a3b..011f2a36 100644 --- a/project_sample/settings.py +++ b/project_sample/settings.py @@ -129,7 +129,8 @@ 'django.contrib.humanize', # Uncomment the next line to enable the admin: 'django.contrib.admin', - 'schedule' + 'schedule', + 'south' # Uncomment the next line to enable admin documentation: # 'django.contrib.admindocs', ) diff --git a/schedule/migrations/0001_initial.py b/schedule/migrations/0001_initial.py new file mode 100644 index 00000000..29283a10 --- /dev/null +++ b/schedule/migrations/0001_initial.py @@ -0,0 +1,195 @@ +# -*- coding: utf-8 -*- +from south.utils import datetime_utils as 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 'Calendar' + db.create_table(u'schedule_calendar', ( + (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('name', self.gf('django.db.models.fields.CharField')(max_length=200)), + ('slug', self.gf('django.db.models.fields.SlugField')(max_length=200)), + )) + db.send_create_signal('schedule', ['Calendar']) + + # Adding model 'CalendarRelation' + db.create_table(u'schedule_calendarrelation', ( + (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('calendar', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['schedule.Calendar'])), + ('content_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['contenttypes.ContentType'])), + ('object_id', self.gf('django.db.models.fields.IntegerField')()), + ('distinction', self.gf('django.db.models.fields.CharField')(max_length=20, null=True)), + ('inheritable', self.gf('django.db.models.fields.BooleanField')(default=True)), + )) + db.send_create_signal('schedule', ['CalendarRelation']) + + # Adding model 'Rule' + db.create_table(u'schedule_rule', ( + (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('name', self.gf('django.db.models.fields.CharField')(max_length=32)), + ('description', self.gf('django.db.models.fields.TextField')()), + ('frequency', self.gf('django.db.models.fields.CharField')(max_length=10)), + ('params', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), + )) + db.send_create_signal('schedule', ['Rule']) + + # Adding model 'Event' + db.create_table(u'schedule_event', ( + (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('start', self.gf('django.db.models.fields.DateTimeField')()), + ('end', self.gf('django.db.models.fields.DateTimeField')()), + ('title', self.gf('django.db.models.fields.CharField')(max_length=255)), + ('description', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), + ('creator', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='creator', null=True, to=orm['auth.User'])), + ('created_on', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)), + ('rule', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['schedule.Rule'], null=True, blank=True)), + ('end_recurring_period', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)), + ('calendar', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['schedule.Calendar'], null=True, blank=True)), + )) + db.send_create_signal('schedule', ['Event']) + + # Adding model 'EventRelation' + db.create_table(u'schedule_eventrelation', ( + (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('event', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['schedule.Event'])), + ('content_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['contenttypes.ContentType'])), + ('object_id', self.gf('django.db.models.fields.IntegerField')()), + ('distinction', self.gf('django.db.models.fields.CharField')(max_length=20, null=True)), + )) + db.send_create_signal('schedule', ['EventRelation']) + + # Adding model 'Occurrence' + db.create_table(u'schedule_occurrence', ( + (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('event', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['schedule.Event'])), + ('title', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True)), + ('description', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), + ('start', self.gf('django.db.models.fields.DateTimeField')()), + ('end', self.gf('django.db.models.fields.DateTimeField')()), + ('cancelled', self.gf('django.db.models.fields.BooleanField')(default=False)), + ('original_start', self.gf('django.db.models.fields.DateTimeField')()), + ('original_end', self.gf('django.db.models.fields.DateTimeField')()), + )) + db.send_create_signal('schedule', ['Occurrence']) + + + def backwards(self, orm): + # Deleting model 'Calendar' + db.delete_table(u'schedule_calendar') + + # Deleting model 'CalendarRelation' + db.delete_table(u'schedule_calendarrelation') + + # Deleting model 'Rule' + db.delete_table(u'schedule_rule') + + # Deleting model 'Event' + db.delete_table(u'schedule_event') + + # Deleting model 'EventRelation' + db.delete_table(u'schedule_eventrelation') + + # Deleting model 'Occurrence' + db.delete_table(u'schedule_occurrence') + + + models = { + u'auth.group': { + 'Meta': {'object_name': 'Group'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) + }, + u'auth.permission': { + 'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + u'auth.user': { + 'Meta': {'object_name': 'User'}, + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + u'contenttypes.contenttype': { + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + }, + 'schedule.calendar': { + 'Meta': {'object_name': 'Calendar'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '200'}) + }, + 'schedule.calendarrelation': { + 'Meta': {'object_name': 'CalendarRelation'}, + 'calendar': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['schedule.Calendar']"}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), + 'distinction': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'inheritable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'object_id': ('django.db.models.fields.IntegerField', [], {}) + }, + 'schedule.event': { + 'Meta': {'object_name': 'Event'}, + 'calendar': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['schedule.Calendar']", 'null': 'True', 'blank': 'True'}), + 'created_on': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'creator'", 'null': 'True', 'to': u"orm['auth.User']"}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'end': ('django.db.models.fields.DateTimeField', [], {}), + 'end_recurring_period': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'rule': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['schedule.Rule']", 'null': 'True', 'blank': 'True'}), + 'start': ('django.db.models.fields.DateTimeField', [], {}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}) + }, + 'schedule.eventrelation': { + 'Meta': {'object_name': 'EventRelation'}, + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), + 'distinction': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True'}), + 'event': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['schedule.Event']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'object_id': ('django.db.models.fields.IntegerField', [], {}) + }, + 'schedule.occurrence': { + 'Meta': {'object_name': 'Occurrence'}, + 'cancelled': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'end': ('django.db.models.fields.DateTimeField', [], {}), + 'event': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['schedule.Event']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'original_end': ('django.db.models.fields.DateTimeField', [], {}), + 'original_start': ('django.db.models.fields.DateTimeField', [], {}), + 'start': ('django.db.models.fields.DateTimeField', [], {}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}) + }, + 'schedule.rule': { + 'Meta': {'object_name': 'Rule'}, + 'description': ('django.db.models.fields.TextField', [], {}), + 'frequency': ('django.db.models.fields.CharField', [], {'max_length': '10'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '32'}), + 'params': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}) + } + } + + complete_apps = ['schedule'] \ No newline at end of file diff --git a/schedule/migrations/__init__.py b/schedule/migrations/__init__.py new file mode 100644 index 00000000..e69de29b From 9acb10f1ca44597658e3fd3c0cbff4c3a65e16fc Mon Sep 17 00:00:00 2001 From: Sergey Fursov Date: Sun, 29 Dec 2013 14:58:36 +0400 Subject: [PATCH 3/3] new fields in Event and Occurrence models for tracking timestamps --- ...ted_on__add_field_occurrence_updated_on.py | 142 ++++++++++++++++++ schedule/models/events.py | 5 +- 2 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 schedule/migrations/0002_auto__add_field_occurrence_created_on__add_field_occurrence_updated_on.py diff --git a/schedule/migrations/0002_auto__add_field_occurrence_created_on__add_field_occurrence_updated_on.py b/schedule/migrations/0002_auto__add_field_occurrence_created_on__add_field_occurrence_updated_on.py new file mode 100644 index 00000000..2375c804 --- /dev/null +++ b/schedule/migrations/0002_auto__add_field_occurrence_created_on__add_field_occurrence_updated_on.py @@ -0,0 +1,142 @@ +# -*- coding: utf-8 -*- +from south.utils import datetime_utils as datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + # Adding field 'Occurrence.created_on' + db.add_column(u'schedule_occurrence', 'created_on', + self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, default=datetime.datetime(2013, 12, 28, 0, 0), blank=True), + keep_default=False) + + # Adding field 'Occurrence.updated_on' + db.add_column(u'schedule_occurrence', 'updated_on', + self.gf('django.db.models.fields.DateTimeField')(auto_now=True, default=datetime.datetime(2013, 12, 28, 0, 0), blank=True), + keep_default=False) + + # Adding field 'Event.updated_on' + db.add_column(u'schedule_event', 'updated_on', + self.gf('django.db.models.fields.DateTimeField')(auto_now=True, default=datetime.datetime(2013, 12, 28, 0, 0), blank=True), + keep_default=False) + + + # Changing field 'Event.created_on' + db.alter_column(u'schedule_event', 'created_on', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True)) + + def backwards(self, orm): + # Deleting field 'Occurrence.created_on' + db.delete_column(u'schedule_occurrence', 'created_on') + + # Deleting field 'Occurrence.updated_on' + db.delete_column(u'schedule_occurrence', 'updated_on') + + # Deleting field 'Event.updated_on' + db.delete_column(u'schedule_event', 'updated_on') + + + # Changing field 'Event.created_on' + db.alter_column(u'schedule_event', 'created_on', self.gf('django.db.models.fields.DateTimeField')()) + + models = { + u'auth.group': { + 'Meta': {'object_name': 'Group'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) + }, + u'auth.permission': { + 'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + u'auth.user': { + 'Meta': {'object_name': 'User'}, + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + u'contenttypes.contenttype': { + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + }, + 'schedule.calendar': { + 'Meta': {'object_name': 'Calendar'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '200'}) + }, + 'schedule.calendarrelation': { + 'Meta': {'object_name': 'CalendarRelation'}, + 'calendar': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['schedule.Calendar']"}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), + 'distinction': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'inheritable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'object_id': ('django.db.models.fields.IntegerField', [], {}) + }, + 'schedule.event': { + 'Meta': {'object_name': 'Event'}, + 'calendar': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['schedule.Calendar']", 'null': 'True', 'blank': 'True'}), + 'created_on': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'creator'", 'null': 'True', 'to': u"orm['auth.User']"}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'end': ('django.db.models.fields.DateTimeField', [], {}), + 'end_recurring_period': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'rule': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['schedule.Rule']", 'null': 'True', 'blank': 'True'}), + 'start': ('django.db.models.fields.DateTimeField', [], {}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'updated_on': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}) + }, + 'schedule.eventrelation': { + 'Meta': {'object_name': 'EventRelation'}, + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), + 'distinction': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True'}), + 'event': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['schedule.Event']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'object_id': ('django.db.models.fields.IntegerField', [], {}) + }, + 'schedule.occurrence': { + 'Meta': {'object_name': 'Occurrence'}, + 'cancelled': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'created_on': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'end': ('django.db.models.fields.DateTimeField', [], {}), + 'event': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['schedule.Event']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'original_end': ('django.db.models.fields.DateTimeField', [], {}), + 'original_start': ('django.db.models.fields.DateTimeField', [], {}), + 'start': ('django.db.models.fields.DateTimeField', [], {}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'updated_on': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}) + }, + 'schedule.rule': { + 'Meta': {'object_name': 'Rule'}, + 'description': ('django.db.models.fields.TextField', [], {}), + 'frequency': ('django.db.models.fields.CharField', [], {'max_length': '10'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '32'}), + 'params': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}) + } + } + + complete_apps = ['schedule'] \ No newline at end of file diff --git a/schedule/models/events.py b/schedule/models/events.py index 5ccee303..0982dbae 100644 --- a/schedule/models/events.py +++ b/schedule/models/events.py @@ -34,7 +34,8 @@ class Event(models.Model): description = models.TextField(_("description"), null=True, blank=True) creator = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, blank=True, verbose_name=_("creator"), related_name='creator') - created_on = models.DateTimeField(_("created on"), default=timezone.now) + created_on = models.DateTimeField(_("created on"), auto_now_add=True) + updated_on = models.DateTimeField(_("updated on"), auto_now=True) rule = models.ForeignKey(Rule, null=True, blank=True, verbose_name=_("rule"), help_text=_("Select '----' for a one time only event.")) end_recurring_period = models.DateTimeField(_("end recurring period"), null=True, blank=True, @@ -343,6 +344,8 @@ class Occurrence(models.Model): cancelled = models.BooleanField(_("cancelled"), default=False) original_start = models.DateTimeField(_("original start")) original_end = models.DateTimeField(_("original end")) + created_on = models.DateTimeField(_("created on"), auto_now_add=True) + updated_on = models.DateTimeField(_("updated on"), auto_now=True) class Meta: verbose_name = _("occurrence")