Commits

Anonymous committed e82a6da

Migration to Django 1.4.1 and adding South

Comments (0)

Files changed (11)

agenda/events/feeds.py

 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
-from django.contrib.syndication.feeds import Feed, FeedDoesNotExist
+from django.contrib.syndication.views import Feed, FeedDoesNotExist
 from django.utils.feedgenerator import Rss201rev2Feed
 from django.core.exceptions import ObjectDoesNotExist
 from django.http import HttpResponse

agenda/events/migrations/0001_initial.py

+# -*- 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 'Region'
+        db.create_table('events_region', (
+            ('id', self.gf('django.db.models.fields.PositiveSmallIntegerField')(primary_key=True)),
+            ('name', self.gf('django.db.models.fields.CharField')(max_length=200)),
+        ))
+        db.send_create_signal('events', ['Region'])
+
+        # Adding model 'City'
+        db.create_table('events_city', (
+            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+            ('name', self.gf('django.db.models.fields.CharField')(max_length=200)),
+            ('region', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['events.Region'])),
+            ('latitude', self.gf('django.db.models.fields.FloatField')()),
+            ('longitude', self.gf('django.db.models.fields.FloatField')()),
+        ))
+        db.send_create_signal('events', ['City'])
+
+        # Adding model 'Event'
+        db.create_table('events_event', (
+            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+            ('title', self.gf('django.db.models.fields.CharField')(max_length=200)),
+            ('description', self.gf('django.db.models.fields.TextField')()),
+            ('url', self.gf('django.db.models.fields.URLField')(max_length=200)),
+            ('tags', self.gf('agenda.tagging.fields.TagField')(max_length=255, blank=True)),
+            ('start_time', self.gf('django.db.models.fields.DateTimeField')()),
+            ('end_time', self.gf('django.db.models.fields.DateTimeField')()),
+            ('scope', self.gf('django.db.models.fields.CharField')(default='L', max_length=1)),
+            ('submission_time', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
+            ('updated_time', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
+            ('venue', self.gf('django.db.models.fields.CharField')(max_length=200, blank=True)),
+            ('address', self.gf('django.db.models.fields.CharField')(max_length=200)),
+            ('city', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['events.City'])),
+            ('latitude', self.gf('django.db.models.fields.FloatField')(default=0, blank=True)),
+            ('longitude', self.gf('django.db.models.fields.FloatField')(default=0, blank=True)),
+            ('contact', self.gf('django.db.models.fields.CharField')(max_length=200)),
+            ('contact_email', self.gf('django.db.models.fields.EmailField')(max_length=200)),
+            ('moderator', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='moderated_events', null=True, to=orm['auth.User'])),
+            ('moderated', self.gf('django.db.models.fields.BooleanField')(default=False)),
+            ('decision_time', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
+            ('submiter_email', self.gf('django.db.models.fields.EmailField')(max_length=200)),
+        ))
+        db.send_create_signal('events', ['Event'])
+
+
+    def backwards(self, orm):
+        # Deleting model 'Region'
+        db.delete_table('events_region')
+
+        # Deleting model 'City'
+        db.delete_table('events_city')
+
+        # Deleting model 'Event'
+        db.delete_table('events_event')
+
+
+    models = {
+        'auth.group': {
+            'Meta': {'object_name': 'Group'},
+            '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': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
+        },
+        'auth.permission': {
+            'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
+            'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+        },
+        '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': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
+            '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': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
+            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+        },
+        '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'}),
+            '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'})
+        },
+        'events.city': {
+            'Meta': {'object_name': 'City'},
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'latitude': ('django.db.models.fields.FloatField', [], {}),
+            'longitude': ('django.db.models.fields.FloatField', [], {}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
+            'region': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['events.Region']"})
+        },
+        'events.event': {
+            'Meta': {'object_name': 'Event'},
+            'address': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
+            'city': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['events.City']"}),
+            'contact': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
+            'contact_email': ('django.db.models.fields.EmailField', [], {'max_length': '200'}),
+            'decision_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+            'description': ('django.db.models.fields.TextField', [], {}),
+            'end_time': ('django.db.models.fields.DateTimeField', [], {}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'latitude': ('django.db.models.fields.FloatField', [], {'default': '0', 'blank': 'True'}),
+            'longitude': ('django.db.models.fields.FloatField', [], {'default': '0', 'blank': 'True'}),
+            'moderated': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'moderator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'moderated_events'", 'null': 'True', 'to': "orm['auth.User']"}),
+            'scope': ('django.db.models.fields.CharField', [], {'default': "'L'", 'max_length': '1'}),
+            'start_time': ('django.db.models.fields.DateTimeField', [], {}),
+            'submission_time': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'submiter_email': ('django.db.models.fields.EmailField', [], {'max_length': '200'}),
+            'tags': ('agenda.tagging.fields.TagField', [], {'max_length': '255', 'blank': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
+            'updated_time': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
+            'url': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
+            'venue': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'})
+        },
+        'events.region': {
+            'Meta': {'object_name': 'Region'},
+            'id': ('django.db.models.fields.PositiveSmallIntegerField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '200'})
+        }
+    }
+
+    complete_apps = ['events']

agenda/events/migrations/__init__.py

Empty file added.

agenda/events/urls.py

     (r'^stats/$', 'agenda.events.views.stats'),
 
     (r'^feeds/$', 'agenda.events.views.feed_list'),
-    (r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed',
+    (r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.Feed',
         {'feed_dict': feeds}),
 
     (r'^calendar/$', UpcomingEventCalendar()),
     (r'^calendar_region/(?P<region_id>\d+)/$', 'agenda.events.views.calendar_region'),
 
 )
-

agenda/settings.py

 import agenda
 import os
 
-DEBUG = True 
+DEBUG = True
 TEMPLATE_DEBUG = DEBUG
 PROJECT_ROOT = os.path.dirname(agenda.__file__)
 
 
 MANAGERS = ADMINS
 
-DATABASE_ENGINE = 'sqlite3'           # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
-DATABASE_NAME = 'agendadulibre'             # Or path to database file if using sqlite3.
-DATABASE_USER = 'agendadulibre'             # Not used with sqlite3.
-DATABASE_PASSWORD = ''         # Not used with sqlite3.
-DATABASE_HOST = ''             # Set to empty string for localhost. Not used with sqlite3.
-DATABASE_PORT = ''             # Set to empty string for default. Not used with sqlite3.
+DATABASES = {
+    "default": {
+        "ENGINE": 'django.db.backends.sqlite3',
+        "NAME": 'agendadulibre',
+        "USER": 'agendadulibre',
+        "PASSWORD": '',
+        "HOST": '',
+        "PORT": '',
+        }
+    }
 
 # Local time zone for this installation. Choices can be found here:
 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
 # Make this unique, and don't share it with anybody.
 SECRET_KEY = '2oaw+105(kzy2ybr58@%1u&w_!5r6)ykg6wk9+=3+m#j*@7!n_'
 
-# List of callables that know how to import templates from various sources.
 TEMPLATE_LOADERS = (
-    'django.template.loaders.filesystem.load_template_source',
-    'django.template.loaders.app_directories.load_template_source',
-    'django.template.loaders.eggs.load_template_source',
+    'django.template.loaders.filesystem.Loader',
+    'django.template.loaders.app_directories.Loader',
+    'django.template.loaders.eggs.Loader'
 )
 
 MIDDLEWARE_CLASSES = (
     'django.contrib.admin',
     'django.contrib.humanize',
     'agenda.tagging',
-    'agenda.events'
+    'agenda.events',
+    'south'
 )
 
 FORCE_LOWERCASE_TAGS = True

agenda/tagging/fields.py

 from django.db.models.fields import CharField
 from django.utils.translation import ugettext_lazy as _
 
+from south.modelsinspector import add_introspection_rules
+
 from agenda import settings
 from agenda.tagging.models import Tag
 from agenda.tagging.utils import edit_string_for_tags
         defaults = {'form_class': forms.TagField}
         defaults.update(kwargs)
         return super(TagField, self).formfield(**defaults)
+
+add_introspection_rules([], ["^agenda\.tagging\.fields\.TagField"])

agenda/tagging/migrations/0001_initial.py

+# -*- 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 'Tag'
+        db.create_table('tagging_tag', (
+            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+            ('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=50, db_index=True)),
+        ))
+        db.send_create_signal('tagging', ['Tag'])
+
+        # Adding model 'TaggedItem'
+        db.create_table('tagging_taggeditem', (
+            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+            ('tag', self.gf('django.db.models.fields.related.ForeignKey')(related_name='items', to=orm['tagging.Tag'])),
+            ('content_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['contenttypes.ContentType'])),
+            ('object_id', self.gf('django.db.models.fields.PositiveIntegerField')(db_index=True)),
+        ))
+        db.send_create_signal('tagging', ['TaggedItem'])
+
+        # Adding unique constraint on 'TaggedItem', fields ['tag', 'content_type', 'object_id']
+        db.create_unique('tagging_taggeditem', ['tag_id', 'content_type_id', 'object_id'])
+
+
+    def backwards(self, orm):
+        # Removing unique constraint on 'TaggedItem', fields ['tag', 'content_type', 'object_id']
+        db.delete_unique('tagging_taggeditem', ['tag_id', 'content_type_id', 'object_id'])
+
+        # Deleting model 'Tag'
+        db.delete_table('tagging_tag')
+
+        # Deleting model 'TaggedItem'
+        db.delete_table('tagging_taggeditem')
+
+
+    models = {
+        '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'}),
+            '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'})
+        },
+        'tagging.tag': {
+            'Meta': {'ordering': "('name',)", 'object_name': 'Tag'},
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '50', 'db_index': 'True'})
+        },
+        'tagging.taggeditem': {
+            'Meta': {'unique_together': "(('tag', 'content_type', 'object_id'),)", 'object_name': 'TaggedItem'},
+            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'object_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
+            'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'items'", 'to': "orm['tagging.Tag']"})
+        }
+    }
+
+    complete_apps = ['tagging']

agenda/tagging/migrations/__init__.py

Empty file added.

agendadulibre

Binary file modified.
 extions = lovely.buildouthttp
 unzip = true
 versions=versions
-eggs = 
+eggs =
 
 [versions]
-django=1.2.4
+django=1.4.1
 zc.recipe.cmmi=1.3.2
 
 [eggs]
 
 [django]
 recipe=djangorecipe
-version=1.2.4
 settings = settings
 eggs = ${eggs:eggs}
 wsgi = true
         'vobject',
         'werkzeug',
         'djangorecipe',
-        'django'],
+        'South',
+        'django==1.4.1'],
       entry_points={
         'django.apps': [
             'agenda = agenda'