Permalink
Browse files

Merge pull request #48 from alfredo/stage

Initial fixtures
  • Loading branch information...
2 parents daef816 + b3ebe9f commit b29739d1a3e91865f19f8d69238ccc319d646964 @rossbruniges committed May 10, 2012
Showing with 252 additions and 0 deletions.
  1. +252 −0 apps/challenges/migrations/0032_initial_fixtures.py
@@ -0,0 +1,252 @@
+# encoding: utf-8
+import datetime
+from south.db import db
+from south.v2 import DataMigration
+from django.db import models
+from django.core.exceptions import ObjectDoesNotExist
+from dateutil.relativedelta import relativedelta
+
+
+IGNITE_PROJECT_SLUG = 'us-ignite'
+IGNITE_CHALLENGE_SLUG = 'ignite-challenge'
+IDEATION_SLUG = 'Ideation'
+
+
+class Migration(DataMigration):
+
+ def forwards(self, orm):
+ "Write your forwards methods here."
+ try:
+ project = orm['projects.Project'].objects.get(slug=IGNITE_PROJECT_SLUG)
+ except ObjectDoesNotExist:
+ project_data = {
+ 'name': 'Ignite Challenge',
+ 'slug': IGNITE_PROJECT_SLUG,
+ 'description': '',
+ 'long_description': '',
+ 'allow_participation': True,
+ }
+ project = orm['projects.Project'].objects.create(**project_data)
+
+ end_date = datetime.datetime.now() + relativedelta(months=3)
+ try:
+ challege = (orm['challenges.Challenge'].objects
+ .get(slug=IGNITE_CHALLENGE_SLUG))
+ except ObjectDoesNotExist:
+ print ('WARNING: Challenge end date setup to %s. Amend this in '
+ 'the admin' % end_date)
+ challenge_data = {
+ 'title': 'Ignite Challenge',
+ 'slug': IGNITE_CHALLENGE_SLUG,
+ 'summary': '',
+ 'description': '',
+ 'end_date': end_date,
+ 'project': project,
+ }
+ challenge = orm['challenges.Challenge'].objects.create(**challenge_data)
+ try:
+ phase = orm['challenges.Phase'].objects.get(name=IDEATION_SLUG)
+ except ObjectDoesNotExist:
+ print ('WARNING: Phase end date setup to %s. Amend this in '
+ 'the admin' % end_date)
+ phase_data = {
+ 'name': IDEATION_SLUG,
+ 'end_date': end_date,
+ 'challenge': challenge,
+ 'order': 1,
+ }
+ phase = orm['challenges.Phase'].objects.create(**phase_data)
+
+ def backwards(self, orm):
+ "Write your backwards methods here."
+ print "Not removing any data from the DB, we can't know for certain what was there before"
+ pass
+
+
+ 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', [], {'unique': 'True', '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'})
+ },
+ 'challenges.category': {
+ 'Meta': {'object_name': 'Category'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '60'}),
+ 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '60', 'db_index': 'True'})
+ },
+ 'challenges.challenge': {
+ 'Meta': {'object_name': 'Challenge'},
+ 'allow_voting': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'description': ('django.db.models.fields.TextField', [], {}),
+ 'end_date': ('django.db.models.fields.DateTimeField', [], {}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
+ 'moderate': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['projects.Project']"}),
+ 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '60', 'db_index': 'True'}),
+ 'start_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.utcnow'}),
+ 'summary': ('django.db.models.fields.TextField', [], {}),
+ 'title': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '60'})
+ },
+ 'challenges.exclusionflag': {
+ 'Meta': {'object_name': 'ExclusionFlag'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'notes': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ 'submission': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['challenges.Submission']"})
+ },
+ 'challenges.externallink': {
+ 'Meta': {'object_name': 'ExternalLink'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
+ 'submission': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['challenges.Submission']", 'null': 'True', 'blank': 'True'}),
+ 'url': ('django.db.models.fields.URLField', [], {'max_length': '255'})
+ },
+ 'challenges.judgeassignment': {
+ 'Meta': {'unique_together': "(('submission', 'judge'),)", 'object_name': 'JudgeAssignment'},
+ 'created_on': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.utcnow'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'judge': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['users.Profile']"}),
+ 'submission': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['challenges.Submission']"})
+ },
+ 'challenges.judgement': {
+ 'Meta': {'unique_together': "(('submission', 'judge'),)", 'object_name': 'Judgement'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'judge': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['users.Profile']"}),
+ 'notes': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ 'submission': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['challenges.Submission']"})
+ },
+ 'challenges.judginganswer': {
+ 'Meta': {'unique_together': "(('judgement', 'criterion'),)", 'object_name': 'JudgingAnswer'},
+ 'criterion': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['challenges.JudgingCriterion']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'judgement': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'answers'", 'to': "orm['challenges.Judgement']"}),
+ 'rating': ('django.db.models.fields.IntegerField', [], {})
+ },
+ 'challenges.judgingcriterion': {
+ 'Meta': {'ordering': "('id',)", 'object_name': 'JudgingCriterion'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'max_value': ('django.db.models.fields.IntegerField', [], {'default': '10'}),
+ 'phases': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'judgement_criteria'", 'blank': 'True', 'through': "orm['challenges.PhaseCriterion']", 'to': "orm['challenges.Phase']"}),
+ 'question': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '250'})
+ },
+ 'challenges.phase': {
+ 'Meta': {'ordering': "('order',)", 'unique_together': "(('challenge', 'name'),)", 'object_name': 'Phase'},
+ 'challenge': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'phases'", 'to': "orm['challenges.Challenge']"}),
+ 'end_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2012, 11, 10, 14, 14, 38, 746513)'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'order': ('django.db.models.fields.IntegerField', [], {}),
+ 'start_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.utcnow'})
+ },
+ 'challenges.phasecriterion': {
+ 'Meta': {'unique_together': "(('phase', 'criterion'),)", 'object_name': 'PhaseCriterion'},
+ 'criterion': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['challenges.JudgingCriterion']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'phase': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['challenges.Phase']"}),
+ 'weight': ('django.db.models.fields.DecimalField', [], {'default': '10', 'max_digits': '4', 'decimal_places': '2'})
+ },
+ 'challenges.submission': {
+ 'Meta': {'ordering': "['-id']", 'object_name': 'Submission'},
+ 'brief_description': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
+ 'category': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['challenges.Category']"}),
+ 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['users.Profile']"}),
+ 'created_on': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.utcnow'}),
+ 'description': ('django.db.models.fields.TextField', [], {}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'interest_making': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'is_draft': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'is_winner': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'life_improvements': ('django.db.models.fields.TextField', [], {'default': "''"}),
+ 'phase': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['challenges.Phase']"}),
+ 'sketh_note': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
+ 'take_advantage': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'team_members': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'title': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '60'})
+ },
+ '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'})
+ },
+ 'projects.project': {
+ 'Meta': {'object_name': 'Project'},
+ 'allow_participation': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'allow_sub_projects': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'description': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
+ 'featured': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'featured_image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
+ 'followers': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'projects_following'", 'symmetrical': 'False', 'to': "orm['users.Profile']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
+ 'long_description': ('django.db.models.fields.TextField', [], {}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'parent_project_id': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100', 'db_index': 'True'}),
+ 'sub_project_label': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}),
+ 'team_members': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['users.Profile']", 'symmetrical': 'False'}),
+ 'topics': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['topics.Topic']", 'symmetrical': 'False'})
+ },
+ 'taggit.tag': {
+ 'Meta': {'object_name': 'Tag'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100', 'db_index': 'True'})
+ },
+ 'taggit.taggeditem': {
+ 'Meta': {'object_name': 'TaggedItem'},
+ 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}),
+ 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"})
+ },
+ 'topics.topic': {
+ 'Meta': {'object_name': 'Topic'},
+ 'description': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'draft': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '250', 'null': 'True', 'blank': 'True'}),
+ 'long_description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100', 'db_index': 'True'})
+ },
+ 'users.profile': {
+ 'Meta': {'object_name': 'Profile'},
+ 'avatar': ('django.db.models.fields.files.ImageField', [], {'max_length': '250', 'null': 'True', 'blank': 'True'}),
+ 'bio': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ 'featured': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'featured_image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'user': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True', 'primary_key': 'True'}),
+ 'website': ('django.db.models.fields.URLField', [], {'max_length': '255', 'blank': 'True'})
+ }
+ }
+
+ complete_apps = ['challenges']

0 comments on commit b29739d

Please sign in to comment.