示例#1
0
def build_models_from_file(file_path, module_name):
    data = yaml_loader(file_path)

    models = dict(
        (table2model(model[0]), build_model(model, module_name)
         ) for model in data.iteritems()
    )

    models.update({'__all__': models.keys()})

    return models
def get_models(request):
    model_admins, admin_fields = _get_all_admin_fields(request)
    models = {}
    for model in admin_fields:
        models.update(
            _get_fields_for_model(request, model, model_admins[model], admin_fields)
        )
    types = {
        type_.name: OrmModel(get_fields_for_type(type_)) for type_ in TYPES.values()
    }

    return {**models, **types}
示例#3
0
    def load_on_migrate(cls, license_id):
        license = License.objects.filter(id=license_id).first()
        db = CompanyDatabase.objects.filter(company_id=license.company_id).first()
        module = Apps.objects.using(db.db_name).filter(module_id=license.module_id).first()
        models = apps.all_models[module.slug]
        models.update(apps.all_models['users'])
        for m in models:
            model_instance = Model.objects.using(db.db_name).filter(app=module,
                                                                    name=m).first()
            if model_instance is None:
                model_instance = cls()

            model_instance.name = m
            model_instance.app = module
            model_instance.save(using=db.db_name)
示例#4
0
class Migration(BasePublishableDataMigration):
    # TODO:
    # this is only temporary, it should be constructed dynamically
    # from each migration in installed_apps, that contains run_before
#    _depends_on = (
#        ('recepty.recipes', 'recipes', '0001_initial'),
#    )
#    depends_on = []
#    for app, label, migration in _depends_on:
#        if app in settings.INSTALLED_APPS:
#            depends_on.append((label, migration))

    models = dict.copy(BasePublishableDataMigration.models)
    models.update(
        {
            'articles.article': {
                'Meta': {'ordering': "('-created',)", '_bases': ['ella.core.models.publishable.Publishable']},
                'created': ('models.DateTimeField', ["_('Created')"], {'default': 'datetime.datetime.now', 'editable': 'False', 'db_index': 'True'}),
                'publishable_ptr': ('models.OneToOneField', ["orm['core.Publishable']"], {}),
                'updated': ('models.DateTimeField', ["_('Updated')"], {'null': 'True', 'blank': 'True'}),
                'upper_title': ('models.CharField', ["_('Upper title')"], {'max_length': '255', 'blank': 'True'})
            },
        }
    )

    app_label = 'articles'
    model = 'article'
    table = '%s_%s' % (app_label, model)

    publishable_uncommon_cols = {
        'source_id': 'source_id',
        'description': 'perex',
    }

    def alter_self_foreignkeys(self, orm):
        # migrate authors as in base
        super(Migration, self).alter_self_foreignkeys(orm)
        # migrate new article IDs to articlecontents
        alter_foreignkey_to_int('articles_articlecontents', 'article')
        # migrate new article IDs to oldrecipearticleredirect
        if 'recepty.recipes' in settings.INSTALLED_APPS:
            # TODO: this should be solved via plugins
            alter_foreignkey_to_int('recipes_oldrecipearticleredirect', 'new_id')

    def move_self_foreignkeys(self, orm):
        # migrate authors as in base
        super(Migration, self).move_self_foreignkeys(orm)
        # migrate new article IDs to articlecontents
        migrate_foreignkey(self.app_label, self.model, 'articles_articlecontents', self.model, self.orm)
        if 'recepty.recipes' in settings.INSTALLED_APPS:
            # migrate new article IDs to oldrecipearticleredirect
            migrate_foreignkey(self.app_label, self.model, 'recipes_oldrecipearticleredirect', 'new_id', self.orm)
示例#5
0
class Migration(BasePublishableDataMigration):
    models = dict.copy(BasePublishableDataMigration.models)
    models.update({
        'galleries.gallery': {
            'Meta': {
                '_bases': ['ella.core.models.publishable.Publishable']
            },
            'content': ('models.TextField', ["_('Content')"], {
                'blank': 'True'
            }),
            'created': ('models.DateTimeField', ["_('Created')"], {
                'default': 'datetime.datetime.now',
                'editable': 'False'
            }),
            'publishable_ptr':
            ('models.OneToOneField', ["orm['core.Publishable']"], {})
        },
    })

    app_label = 'galleries'
    model = 'gallery'
    table = '%s_%s' % (app_label, model)

    publishable_uncommon_cols = {
        'description': 'description',
    }

    @property
    def publishable_cols(self):
        c = {
            'title': 'title',
            'slug': 'slug',
            'category_id': 'category_id',
        }
        c.update(self.publishable_uncommon_cols)
        return SortedDict(c)

    def alter_self_foreignkeys(self, orm):
        # there is foreign key to authors called owner instead of ella's classic m2m rel
        alter_foreignkey_to_int('galleries_gallery', 'owner')
        alter_foreignkey_to_int('galleries_galleryitem', 'gallery')

    def move_self_foreignkeys(self, orm):
        # there is foreign key to authors called owner instead of ella's classic m2m rel
        # TODO migrate new gallery IDs to core_publishable_authors
        #migrate_foreignkey(self.app_label, self.model, 'core_publishable_authors', 'publishable_id', self.orm)
        # migrate new gallery IDs to galleryitem
        db.delete_unique('galleries_galleryitem', ('gallery', 'order'))
        migrate_foreignkey(self.app_label, self.model, 'galleries_galleryitem',
                           self.model, self.orm)
        db.create_unique('galleries_galleryitem', ('gallery_id', 'order'))
class Migration(BasePublishableDataMigration):
    models = dict.copy(BasePublishableDataMigration.models)
    models.update({
        'polls.contest': {
            'Meta': {
                'ordering': "('-active_from',)",
                '_bases': ['ella.core.models.publishable.Publishable']
            },
            'active_from': ('models.DateTimeField', ["_('Active from')"], {}),
            'active_till': ('models.DateTimeField', ["_('Active till')"], {}),
            'publishable_ptr':
            ('models.OneToOneField', ["orm['core.Publishable']"], {}),
            'text': ('models.TextField', ["_('Text')"], {}),
            'text_announcement':
            ('models.TextField', ["_('Text with announcement')"], {}),
            'text_results':
            ('models.TextField', ["_('Text with results')"], {})
        },
    })

    app_label = 'polls'
    model = 'contest'
    table = '%s_%s' % (app_label, model)

    publishable_uncommon_cols = {'description': 'text_announcement'}

    def alter_self_foreignkeys(self, orm):
        alter_foreignkey_to_int('polls_question', 'contest',
                                models.IntegerField(blank=True, null=True))
        alter_foreignkey_to_int('polls_contestant', 'contest',
                                models.IntegerField(blank=True))

    def move_self_foreignkeys(self, orm):
        # migrate new contest IDs to question
        migrate_foreignkey(self.app_label,
                           self.model,
                           'polls_question',
                           self.model,
                           self.orm,
                           null=True)
        # migrate new contest IDs to contestant
        migrate_foreignkey(self.app_label, self.model, 'polls_contestant',
                           self.model, self.orm)
示例#7
0
class Migration(BasePublishableDataMigration):
    models = dict.copy(BasePublishableDataMigration.models)
    models.update({
        'series.serie': {
            'Meta': {
                '_bases': ['ella.core.models.publishable.Publishable']
            },
            'finished': ('models.DateField', ["_('Finished')"], {
                'null': 'True',
                'blank': 'True'
            }),
            'hide_newer_parts':
            ('models.BooleanField', ["_('Hide newer parts')"], {
                'default': 'False'
            }),
            'publishable_ptr':
            ('models.OneToOneField', ["orm['core.Publishable']"], {}),
            'started': ('models.DateField', ["_('Started')"], {}),
            'text': ('models.TextField', ["_('Text')"], {})
        },
    })

    app_label = 'series'
    model = 'serie'
    table = '%s_%s' % (app_label, model)
    publishable_uncommon_cols = {
        'description': 'perex',
    }

    def alter_self_foreignkeys(self, orm):
        alter_foreignkey_to_int('series_seriepart', 'serie')

    def move_self_foreignkeys(self, orm):
        # migrate new serie IDs to seriepart
        migrate_foreignkey(self.app_label, self.model, 'series_seriepart',
                           self.model, self.orm)

    def forwards(self, orm):
        db.rename_column('series_serie', 'description', 'text')
        BasePublishableDataMigration().forwards(orm)
class Migration(BasePublishableDataMigration):
    models = dict.copy(BasePublishableDataMigration.models)
    models.update(
        {
            'polls.quiz': {
                'Meta': {'ordering': "('-active_from',)", '_bases': ['ella.core.models.publishable.Publishable']},
                'active_from': ('models.DateTimeField', ["_('Active from')"], {}),
                'active_till': ('models.DateTimeField', ["_('Active till')"], {}),
                'has_correct_answers': ('models.BooleanField', ["_('Has correct answers')"], {}),
                'publishable_ptr': ('models.OneToOneField', ["orm['core.Publishable']"], {}),
                'text': ('models.TextField', ["_('Text')"], {}),
                'text_announcement': ('models.TextField', ["_('Text with announcement')"], {}),
                'text_results': ('models.TextField', ["_('Text with results')"], {})
            },
        }
    )

    app_label = 'polls'
    model = 'quiz'
    table = '%s_%s' % (app_label, model)

    publishable_uncommon_cols = {
        'description': 'text_announcement'
    }
    
    def alter_self_foreignkeys(self, orm):
        # migrate authors as in base
        super(Migration, self).alter_self_foreignkeys(orm)
        alter_foreignkey_to_int('polls_question', 'quiz', null=True)
        alter_foreignkey_to_int('polls_result', 'quiz')

    def move_self_foreignkeys(self, orm):
        # migrate authors as in base
        super(Migration, self).move_self_foreignkeys(orm)
        # migrate new quiz IDs to question
        migrate_foreignkey(self.app_label, self.model, 'polls_question', self.model, self.orm, null=True)
        # migrate new quiz IDs to results
        migrate_foreignkey(self.app_label, self.model, 'polls_result', self.model, self.orm)
示例#9
0
class Migration(SchemaMigration):
    def forwards(self, orm):

        # Adding field 'Notice.last_post'
        db.add_column('noticeapp_notice',
                      'last_post',
                      self.gf('django.db.models.fields.related.ForeignKey')(
                          blank=True,
                          related_name='last_post_in_notice',
                          null=True,
                          to=orm['noticeapp.Post']),
                      keep_default=False)

        # Changing field 'Notice.updated'
        db.alter_column(
            'noticeapp_notice', 'updated',
            self.gf('django.db.models.fields.DateTimeField')(null=True,
                                                             blank=True))

        # Adding field 'Course.last_post'
        db.add_column('noticeapp_course',
                      'last_post',
                      self.gf('django.db.models.fields.related.ForeignKey')(
                          blank=True,
                          related_name='last_post_in_course',
                          null=True,
                          to=orm['noticeapp.Post']),
                      keep_default=False)

    def backwards(self, orm):

        # Deleting field 'Notice.last_post'
        db.delete_column('noticeapp_notice', 'last_post_id')

        # Changing field 'Notice.updated'
        db.alter_column(
            'noticeapp_notice', 'updated',
            self.gf('django.db.models.fields.DateTimeField')(null=True))

        # Deleting field 'Course.last_post'
        db.delete_column('noticeapp_course', 'last_post_id')

    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': {
                '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'
            })
        },
        'contenttypes.contenttype': {
            'Meta': {
                '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'
            })
        },
        'noticeapp.attachment': {
            'Meta': {
                'object_name': 'Attachment'
            },
            'content_type': ('django.db.models.fields.CharField', [], {
                'max_length': '255'
            }),
            'hash': ('django.db.models.fields.CharField', [], {
                'db_index': 'True',
                'max_length': '40',
                'blank': 'True'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'name': ('django.db.models.fields.TextField', [], {}),
            'path': ('django.db.models.fields.CharField', [], {
                'max_length': '255'
            }),
            'post': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'attachments'",
                'to': "orm['noticeapp.Post']"
            }),
            'size': ('django.db.models.fields.IntegerField', [], {})
        },
        'noticeapp.category': {
            'Meta': {
                'object_name': 'Category'
            },
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'name': ('django.db.models.fields.CharField', [], {
                'max_length': '80'
            }),
            'position': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            })
        },
        'noticeapp.notice': {
            'Meta': {
                'object_name': 'Notice'
            },
            'category': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'notices'",
                'to': "orm['noticeapp.Category']"
            }),
            'description': ('django.db.models.fields.TextField', [], {
                'blank': 'True'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'last_post': ('django.db.models.fields.related.ForeignKey', [], {
                'blank': 'True',
                'related_name': "'last_post_in_notice'",
                'null': 'True',
                'to': "orm['noticeapp.Post']"
            }),
            'moderators':
            ('django.db.models.fields.related.ManyToManyField', [], {
                'symmetrical': 'False',
                'to': "orm['%s']" % AUTH_USER,
                'null': 'True',
                'blank': 'True'
            }),
            'name': ('django.db.models.fields.CharField', [], {
                'max_length': '80'
            }),
            'position': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            }),
            'post_count': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            }),
            'course_count': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            }),
            'updated': ('django.db.models.fields.DateTimeField', [], {
                'null': 'True',
                'blank': 'True'
            })
        },
        'noticeapp.post': {
            'Meta': {
                'object_name': 'Post'
            },
            'body': ('django.db.models.fields.TextField', [], {}),
            'body_html': ('django.db.models.fields.TextField', [], {}),
            'body_text': ('django.db.models.fields.TextField', [], {}),
            'created': ('django.db.models.fields.DateTimeField', [], {
                'blank': 'True'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'markup': ('django.db.models.fields.CharField', [], {
                'default': "'bbcode'",
                'max_length': '15'
            }),
            'course': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'posts'",
                'to': "orm['noticeapp.Course']"
            }),
            'updated': ('django.db.models.fields.DateTimeField', [], {
                'null': 'True',
                'blank': 'True'
            }),
            'user': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'posts'",
                'to': "orm['%s']" % AUTH_USER
            }),
            'user_ip': ('django.db.models.fields.IPAddressField', [], {
                'default': "'0.0.0.0'",
                'max_length': '15',
                'blank': 'True'
            })
        },
        'noticeapp.profile': {
            'Meta': {
                'object_name': 'Profile'
            },
            'ban_status': ('django.db.models.fields.SmallIntegerField', [], {
                'default': '0'
            }),
            'ban_till': ('django.db.models.fields.DateTimeField', [], {
                'default': 'None',
                'null': 'True',
                'blank': 'True'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'language': ('django.db.models.fields.CharField', [], {
                'max_length': '10',
                'blank': 'True'
            }),
            'markup': ('django.db.models.fields.CharField', [], {
                'default': "'bbcode'",
                'max_length': '15'
            }),
            'post_count': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            }),
            'show_signatures': ('django.db.models.fields.BooleanField', [], {
                'default': 'True',
                'blank': 'True'
            }),
            'signature': ('django.db.models.fields.TextField', [], {
                'max_length': '1024',
                'blank': 'True'
            }),
            'signature_html': ('django.db.models.fields.TextField', [], {
                'max_length': '1054',
                'blank': 'True'
            }),
            'time_zone': ('django.db.models.fields.FloatField', [], {
                'default': '3.0'
            }),
            'user': ('django.db.models.fields.related.OneToOneField', [], {
                'related_name': "'noticeapp_profile'",
                'unique': 'True',
                'to': "orm['%s']" % AUTH_USER
            })
        },
        'noticeapp.readtracking': {
            'Meta': {
                'object_name': 'ReadTracking'
            },
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'last_read': ('django.db.models.fields.DateTimeField', [], {
                'null': 'True'
            }),
            'courses': ('django.db.models.TextField', [], {}),
            'user': ('django.db.models.fields.related.OneToOneField', [], {
                'to': "orm['%s']" % AUTH_USER,
                'unique': 'True'
            })
        },
        'noticeapp.course': {
            'Meta': {
                'object_name': 'Course'
            },
            'closed': ('django.db.models.fields.BooleanField', [], {
                'default': 'False',
                'blank': 'True'
            }),
            'created': ('django.db.models.fields.DateTimeField', [], {
                'null': 'True'
            }),
            'notice': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'courses'",
                'to': "orm['noticeapp.Notice']"
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'last_post': ('django.db.models.fields.related.ForeignKey', [], {
                'blank': 'True',
                'related_name': "'last_post_in_course'",
                'null': 'True',
                'to': "orm['noticeapp.Post']"
            }),
            'name': ('django.db.models.fields.CharField', [], {
                'max_length': '255'
            }),
            'post_count': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            }),
            'sticky': ('django.db.models.fields.BooleanField', [], {
                'default': 'False',
                'blank': 'True'
            }),
            'subscribers':
            ('django.db.models.fields.related.ManyToManyField', [], {
                'symmetrical': 'False',
                'related_name': "'subscriptions'",
                'blank': 'True',
                'to': "orm['%s']" % AUTH_USER
            }),
            'updated': ('django.db.models.fields.DateTimeField', [], {
                'null': 'True'
            }),
            'user': ('django.db.models.fields.related.ForeignKey', [], {
                'to': "orm['%s']" % AUTH_USER
            }),
            'views': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            })
        }
    }
    models.update(get_user_frozen_models(AUTH_USER))

    complete_apps = ['noticeapp']
示例#10
0
class Migration(SchemaMigration):
    def forwards(self, orm):
        # Adding model 'UserSocialAuth'
        db.create_table('social_auth_usersocialauth', (
            ('id',
             self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('user', self.gf('django.db.models.fields.related.ForeignKey')(
                related_name='social_auth', to=orm[USER_MODEL])),
            ('provider',
             self.gf('django.db.models.fields.CharField')(max_length=32)),
            ('uid', self.gf('django.db.models.fields.CharField')(
                max_length=UID_LENGTH)),
            ('extra_data',
             self.gf('social_auth.fields.JSONField')(default='{}')),
        ))
        db.send_create_signal('social_auth', ['UserSocialAuth'])

        # Adding unique constraint on 'UserSocialAuth', fields ['provider', 'uid']
        db.create_unique('social_auth_usersocialauth', ['provider', 'uid'])

        # Adding model 'Nonce'
        db.create_table('social_auth_nonce', (
            ('id',
             self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('server_url', self.gf('django.db.models.fields.CharField')(
                max_length=NONCE_SERVER_URL_LENGTH)),
            ('timestamp', self.gf('django.db.models.fields.IntegerField')()),
            ('salt',
             self.gf('django.db.models.fields.CharField')(max_length=40)),
        ))
        db.send_create_signal('social_auth', ['Nonce'])

        # Adding model 'Association'
        db.create_table('social_auth_association', (
            ('id',
             self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('server_url', self.gf('django.db.models.fields.CharField')(
                max_length=ASSOCIATION_SERVER_URL_LENGTH)),
            ('handle', self.gf('django.db.models.fields.CharField')(
                max_length=ASSOCIATION_HANDLE_LENGTH)),
            ('secret',
             self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('issued', self.gf('django.db.models.fields.IntegerField')()),
            ('lifetime', self.gf('django.db.models.fields.IntegerField')()),
            ('assoc_type',
             self.gf('django.db.models.fields.CharField')(max_length=64)),
        ))
        db.send_create_signal('social_auth', ['Association'])

    def backwards(self, orm):
        # Removing unique constraint on 'UserSocialAuth', fields ['provider', 'uid']
        db.delete_unique('social_auth_usersocialauth', ['provider', 'uid'])

        # Deleting model 'UserSocialAuth'
        db.delete_table('social_auth_usersocialauth')

        # Deleting model 'Nonce'
        db.delete_table('social_auth_nonce')

        # Deleting model 'Association'
        db.delete_table('social_auth_association')

    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'
            })
        },
        'social_auth.association': {
            'Meta': {
                'object_name': 'Association'
            },
            'assoc_type': ('django.db.models.fields.CharField', [], {
                'max_length': '64'
            }),
            'handle': ('django.db.models.fields.CharField', [], {
                'max_length': str(ASSOCIATION_HANDLE_LENGTH)
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'issued': ('django.db.models.fields.IntegerField', [], {}),
            'lifetime': ('django.db.models.fields.IntegerField', [], {}),
            'secret': ('django.db.models.fields.CharField', [], {
                'max_length': '255'
            }),
            'server_url': ('django.db.models.fields.CharField', [], {
                'max_length': str(ASSOCIATION_SERVER_URL_LENGTH)
            })
        },
        'social_auth.nonce': {
            'Meta': {
                'object_name': 'Nonce'
            },
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'salt': ('django.db.models.fields.CharField', [], {
                'max_length': '40'
            }),
            'server_url': ('django.db.models.fields.CharField', [], {
                'max_length': str(NONCE_SERVER_URL_LENGTH)
            }),
            'timestamp': ('django.db.models.fields.IntegerField', [], {})
        },
        'social_auth.usersocialauth': {
            'Meta': {
                'unique_together': "(('provider', 'uid'),)",
                'object_name': 'UserSocialAuth'
            },
            'extra_data': ('social_auth.fields.JSONField', [], {
                'default': "'{}'"
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'provider': ('django.db.models.fields.CharField', [], {
                'max_length': '32'
            }),
            'uid': ('django.db.models.fields.CharField', [], {
                'max_length': str(UID_LENGTH)
            }),
            'user': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'social_auth'",
                'to': "orm['" + USER_MODEL + "']"
            })
        }
    }
    models.update(custom_user_frozen_models(USER_MODEL))

    complete_apps = ['social_auth']
示例#11
0
class Migration(DataMigration):
    def forwards(self, orm):
        # Note: Remember to use orm['appname.ModelName'] rather than "from appname.models..."
        for dup_group in orm['pybb.TopicReadTracker'].objects.values('topic', 'user')\
                                                     .annotate(Count('topic'), Count('user'))\
                                                     .filter(topic__count__gt=1):
            for dup in orm['pybb.TopicReadTracker'].objects.filter(topic=dup_group['topic'], user=dup_group['user'])\
                                                   .order_by('-time_stamp')[1:]:
                dup.delete()

        for dup_group in orm['pybb.ForumReadTracker'].objects.values('forum', 'user')\
                                                     .annotate(Count('forum'), Count('user'))\
                                                     .filter(forum__count__gt=1):
            for dup in orm['pybb.ForumReadTracker'].objects.filter(topic=dup_group['forum'], user=dup_group['user'])\
                                                   .order_by('-time_stamp')[1:]:
                dup.delete()

    def backwards(self, orm):
        "Write your backwards methods here."
        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'
            })
        },
        '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'
            })
        },
        'pybb.attachment': {
            'Meta': {
                'object_name': 'Attachment'
            },
            'file': ('django.db.models.fields.files.FileField', [], {
                'max_length': '100'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'post': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'attachments'",
                'to': "orm['pybb.Post']"
            }),
            'size': ('django.db.models.fields.IntegerField', [], {})
        },
        'pybb.category': {
            'Meta': {
                'ordering': "['position']",
                'object_name': 'Category'
            },
            'hidden': ('django.db.models.fields.BooleanField', [], {
                'default': 'False'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'name': ('django.db.models.fields.CharField', [], {
                'max_length': '80'
            }),
            'position': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            })
        },
        'pybb.forum': {
            'Meta': {
                'ordering': "['position']",
                'object_name': 'Forum'
            },
            'category': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'forums'",
                'to': "orm['pybb.Category']"
            }),
            'description': ('django.db.models.fields.TextField', [], {
                'blank': 'True'
            }),
            'headline': ('django.db.models.fields.TextField', [], {
                'null': 'True',
                'blank': 'True'
            }),
            'hidden': ('django.db.models.fields.BooleanField', [], {
                'default': 'False'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'moderators':
            ('django.db.models.fields.related.ManyToManyField', [], {
                'symmetrical': 'False',
                'to': "orm['%s']" % AUTH_USER,
                'null': 'True',
                'blank': 'True'
            }),
            'name': ('django.db.models.fields.CharField', [], {
                'max_length': '80'
            }),
            'position': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            }),
            'post_count': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            }),
            'readed_by':
            ('django.db.models.fields.related.ManyToManyField', [], {
                'related_name': "'readed_forums'",
                'symmetrical': 'False',
                'through': "orm['pybb.ForumReadTracker']",
                'to': "orm['%s']" % AUTH_USER
            }),
            'topic_count': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            }),
            'updated': ('django.db.models.fields.DateTimeField', [], {
                'null': 'True',
                'blank': 'True'
            })
        },
        'pybb.forumreadtracker': {
            'Meta': {
                'object_name': 'ForumReadTracker'
            },
            'forum': ('django.db.models.fields.related.ForeignKey', [], {
                'to': "orm['pybb.Forum']",
                'null': 'True',
                'blank': 'True'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'time_stamp': ('django.db.models.fields.DateTimeField', [], {
                'auto_now': 'True',
                'blank': 'True'
            }),
            'user': ('django.db.models.fields.related.ForeignKey', [], {
                'to': "orm['%s']" % AUTH_USER
            })
        },
        'pybb.pollanswer': {
            'Meta': {
                'object_name': 'PollAnswer'
            },
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'text': ('django.db.models.fields.CharField', [], {
                'max_length': '255'
            }),
            'topic': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'poll_answers'",
                'to': "orm['pybb.Topic']"
            })
        },
        'pybb.pollansweruser': {
            'Meta': {
                'unique_together': "(('poll_answer', 'user'),)",
                'object_name': 'PollAnswerUser'
            },
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'poll_answer': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'users'",
                'to': "orm['pybb.PollAnswer']"
            }),
            'timestamp': ('django.db.models.fields.DateTimeField', [], {
                'auto_now_add': 'True',
                'blank': 'True'
            }),
            'user': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'poll_answers'",
                'to': "orm['%s']" % AUTH_USER
            })
        },
        'pybb.post': {
            'Meta': {
                'ordering': "['created']",
                'object_name': 'Post'
            },
            'body': ('django.db.models.fields.TextField', [], {}),
            'body_html': ('django.db.models.fields.TextField', [], {}),
            'body_text': ('django.db.models.fields.TextField', [], {}),
            'created': ('django.db.models.fields.DateTimeField', [], {
                'db_index': 'True',
                'blank': 'True'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'on_moderation': ('django.db.models.fields.BooleanField', [], {
                'default': 'False'
            }),
            'topic': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'posts'",
                'to': "orm['pybb.Topic']"
            }),
            'updated': ('django.db.models.fields.DateTimeField', [], {
                'null': 'True',
                'blank': 'True'
            }),
            'user': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'posts'",
                'to': "orm['%s']" % AUTH_USER
            }),
            'user_ip': ('django.db.models.fields.IPAddressField', [], {
                'default': "'0.0.0.0'",
                'max_length': '15',
                'blank': 'True'
            })
        },
        'pybb.profile': {
            'Meta': {
                'object_name': 'Profile'
            },
            'autosubscribe': ('django.db.models.fields.BooleanField', [], {
                'default': 'True'
            }),
            'avatar': (get_image_field_full_name(), [], {
                'max_length': '100',
                'null': 'True',
                'blank': 'True'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'language': ('django.db.models.fields.CharField', [], {
                'default': "'en-us'",
                'max_length': '10',
                'blank': 'True'
            }),
            'post_count': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            }),
            'show_signatures': ('django.db.models.fields.BooleanField', [], {
                'default': 'True'
            }),
            'signature': ('django.db.models.fields.TextField', [], {
                'max_length': '1024',
                'blank': 'True'
            }),
            'signature_html': ('django.db.models.fields.TextField', [], {
                'max_length': '1054',
                'blank': 'True'
            }),
            'time_zone': ('django.db.models.fields.FloatField', [], {
                'default': '3.0'
            }),
            'user': ('annoying.fields.AutoOneToOneField', [], {
                'related_name': "'pybb_profile'",
                'unique': 'True',
                'to': "orm['%s']" % AUTH_USER
            })
        },
        'pybb.topic': {
            'Meta': {
                'ordering': "['-created']",
                'object_name': 'Topic'
            },
            'closed': ('django.db.models.fields.BooleanField', [], {
                'default': 'False'
            }),
            'created': ('django.db.models.fields.DateTimeField', [], {
                'null': 'True'
            }),
            'forum': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'topics'",
                'to': "orm['pybb.Forum']"
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'name': ('django.db.models.fields.CharField', [], {
                'max_length': '255'
            }),
            'on_moderation': ('django.db.models.fields.BooleanField', [], {
                'default': 'False'
            }),
            'poll_question': ('django.db.models.fields.TextField', [], {
                'null': 'True',
                'blank': 'True'
            }),
            'poll_type': ('django.db.models.fields.IntegerField', [], {
                'default': '0'
            }),
            'post_count': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            }),
            'readed_by':
            ('django.db.models.fields.related.ManyToManyField', [], {
                'related_name': "'readed_topics'",
                'symmetrical': 'False',
                'through': "orm['pybb.TopicReadTracker']",
                'to': "orm['%s']" % AUTH_USER
            }),
            'sticky': ('django.db.models.fields.BooleanField', [], {
                'default': 'False'
            }),
            'subscribers':
            ('django.db.models.fields.related.ManyToManyField', [], {
                'symmetrical': 'False',
                'related_name': "'subscriptions'",
                'blank': 'True',
                'to': "orm['%s']" % AUTH_USER
            }),
            'updated': ('django.db.models.fields.DateTimeField', [], {
                'null': 'True'
            }),
            'user': ('django.db.models.fields.related.ForeignKey', [], {
                'to': "orm['%s']" % AUTH_USER
            }),
            'views': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            })
        },
        'pybb.topicreadtracker': {
            'Meta': {
                'object_name': 'TopicReadTracker'
            },
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'time_stamp': ('django.db.models.fields.DateTimeField', [], {
                'auto_now': 'True',
                'blank': 'True'
            }),
            'topic': ('django.db.models.fields.related.ForeignKey', [], {
                'to': "orm['pybb.Topic']",
                'null': 'True',
                'blank': 'True'
            }),
            'user': ('django.db.models.fields.related.ForeignKey', [], {
                'to': "orm['%s']" % AUTH_USER
            })
        }
    }
    models.update(get_user_frozen_models(AUTH_USER))

    complete_apps = ['pybb']
    symmetrical = True
示例#12
0
class Migration(SchemaMigration):
    def forwards(self, orm):
        # Adding field 'ModelBase.owner_override'
        db.add_column('jmbo_modelbase',
                      'owner_override',
                      self.gf('django.db.models.fields.CharField')(
                          max_length=256, null=True, blank=True),
                      keep_default=False)

        # Adding field 'ModelBase.image_attribution'
        db.add_column('jmbo_modelbase',
                      'image_attribution',
                      self.gf('django.db.models.fields.CharField')(
                          max_length=256, null=True, blank=True),
                      keep_default=False)

    def backwards(self, orm):
        # Deleting field 'ModelBase.owner_override'
        db.delete_column('jmbo_modelbase', 'owner_override')

        # Deleting field 'ModelBase.image_attribution'
        db.delete_column('jmbo_modelbase', 'image_attribution')

    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'
            })
        },
        'category.category': {
            'Meta': {
                'ordering': "('title',)",
                'object_name': 'Category'
            },
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'parent': ('django.db.models.fields.related.ForeignKey', [], {
                'to': "orm['category.Category']",
                'null': 'True',
                'blank': 'True'
            }),
            'sites': ('django.db.models.fields.related.ManyToManyField', [], {
                'symmetrical': 'False',
                'to': "orm['sites.Site']",
                'null': 'True',
                'blank': 'True'
            }),
            'slug': ('django.db.models.fields.SlugField', [], {
                'unique': 'True',
                'max_length': '255'
            }),
            'subtitle': ('django.db.models.fields.CharField', [], {
                'default': "''",
                'max_length': '200',
                'null': 'True',
                'blank': 'True'
            }),
            'title': ('django.db.models.fields.CharField', [], {
                'max_length': '200'
            })
        },
        'category.tag': {
            'Meta': {
                'ordering': "('title',)",
                'object_name': 'Tag'
            },
            'categories':
            ('django.db.models.fields.related.ManyToManyField', [], {
                'symmetrical': 'False',
                'to': "orm['category.Category']",
                'null': 'True',
                'blank': 'True'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'slug': ('django.db.models.fields.SlugField', [], {
                'unique': 'True',
                'max_length': '255'
            }),
            'title': ('django.db.models.fields.CharField', [], {
                'max_length': '200'
            })
        },
        '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'
            })
        },
        'jmbo.modelbase': {
            'Meta': {
                'ordering': "('-created',)",
                'object_name': 'ModelBase'
            },
            'anonymous_comments':
            ('django.db.models.fields.BooleanField', [], {
                'default': 'True'
            }),
            'anonymous_likes': ('django.db.models.fields.BooleanField', [], {
                'default': 'True'
            }),
            'categories':
            ('django.db.models.fields.related.ManyToManyField', [], {
                'symmetrical': 'False',
                'to': "orm['category.Category']",
                'null': 'True',
                'blank': 'True'
            }),
            'class_name': ('django.db.models.fields.CharField', [], {
                'max_length': '32',
                'null': 'True'
            }),
            'comment_count':
            ('django.db.models.fields.PositiveIntegerField', [], {
                'default': '0'
            }),
            'comments_closed': ('django.db.models.fields.BooleanField', [], {
                'default': 'False'
            }),
            'comments_enabled': ('django.db.models.fields.BooleanField', [], {
                'default': 'True'
            }),
            'content_type':
            ('django.db.models.fields.related.ForeignKey', [], {
                'to': "orm['contenttypes.ContentType']",
                'null': 'True'
            }),
            'created': ('django.db.models.fields.DateTimeField', [], {
                'blank': 'True'
            }),
            'crop_from': ('django.db.models.fields.CharField', [], {
                'default': "'center'",
                'max_length': '10',
                'blank': 'True'
            }),
            'date_taken': ('django.db.models.fields.DateTimeField', [], {
                'null': 'True',
                'blank': 'True'
            }),
            'description': ('django.db.models.fields.TextField', [], {
                'null': 'True',
                'blank': 'True'
            }),
            'effect': ('django.db.models.fields.related.ForeignKey', [], {
                'blank': 'True',
                'related_name': "'modelbase_related'",
                'null': 'True',
                'to': "orm['photologue.PhotoEffect']"
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'image': ('django.db.models.fields.files.ImageField', [], {
                'max_length': '100',
                'blank': 'True'
            }),
            'image_attribution': ('django.db.models.fields.CharField', [], {
                'max_length': '256',
                'null': 'True',
                'blank': 'True'
            }),
            'likes_closed': ('django.db.models.fields.BooleanField', [], {
                'default': 'False'
            }),
            'likes_enabled': ('django.db.models.fields.BooleanField', [], {
                'default': 'True'
            }),
            'modified': ('django.db.models.fields.DateTimeField', [], {}),
            'owner': ('django.db.models.fields.related.ForeignKey', [], {
                'to': "orm['auth.User']",
                'null': 'True',
                'blank': 'True'
            }),
            'owner_override': ('django.db.models.fields.CharField', [], {
                'max_length': '256',
                'null': 'True',
                'blank': 'True'
            }),
            'primary_category': ('django.db.models.fields.related.ForeignKey',
                                 [], {
                                     'blank': 'True',
                                     'related_name': "'primary_modelbase_set'",
                                     'null': 'True',
                                     'to': "orm['category.Category']"
                                 }),
            'publish_on': ('django.db.models.fields.DateTimeField', [], {
                'db_index': 'True',
                'null': 'True',
                'blank': 'True'
            }),
            'publishers': ('django.db.models.fields.related.ManyToManyField',
                           [], {
                               'symmetrical': 'False',
                               'to': "orm['publisher.Publisher']",
                               'null': 'True',
                               'blank': 'True'
                           }),
            'retract_on': ('django.db.models.fields.DateTimeField', [], {
                'db_index': 'True',
                'null': 'True',
                'blank': 'True'
            }),
            'sites': ('django.db.models.fields.related.ManyToManyField', [], {
                'symmetrical': 'False',
                'to': "orm['sites.Site']",
                'null': 'True',
                'blank': 'True'
            }),
            'slug': ('django.db.models.fields.SlugField', [], {
                'unique': 'True',
                'max_length': '255'
            }),
            'state': ('django.db.models.fields.CharField', [], {
                'default': "'unpublished'",
                'max_length': '32',
                'null': 'True',
                'blank': 'True'
            }),
            'subtitle': ('django.db.models.fields.CharField', [], {
                'default': "''",
                'max_length': '200',
                'null': 'True',
                'blank': 'True'
            }),
            'tags': ('django.db.models.fields.related.ManyToManyField', [], {
                'symmetrical': 'False',
                'to': "orm['category.Tag']",
                'null': 'True',
                'blank': 'True'
            }),
            'title': ('django.db.models.fields.CharField', [], {
                'max_length': '200'
            }),
            'view_count': ('django.db.models.fields.PositiveIntegerField', [],
                           {
                               'default': '0'
                           }),
            'vote_total': ('django.db.models.fields.PositiveIntegerField', [],
                           {
                               'default': '0'
                           })
        },
        'jmbo.pin': {
            'Meta': {
                'object_name': 'Pin'
            },
            'category': ('django.db.models.fields.related.ForeignKey', [], {
                'to': "orm['category.Category']"
            }),
            'content': ('django.db.models.fields.related.ForeignKey', [], {
                'to': "orm['jmbo.ModelBase']"
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            })
        },
        'jmbo.relation': {
            'Meta': {
                'unique_together':
                "(('source_content_type', 'source_object_id', 'target_content_type', 'target_object_id', 'name'),)",
                'object_name': 'Relation'
            },
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'name': ('django.db.models.fields.CharField', [], {
                'max_length': '32',
                'db_index': 'True'
            }),
            'source_content_type':
            ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'relation_source_content_type'",
                'to': "orm['contenttypes.ContentType']"
            }),
            'source_object_id':
            ('django.db.models.fields.PositiveIntegerField', [], {}),
            'target_content_type':
            ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'relation_target_content_type'",
                'to': "orm['contenttypes.ContentType']"
            }),
            'target_object_id':
            ('django.db.models.fields.PositiveIntegerField', [], {})
        },
        'photologue.photo': {
            'Meta': {
                'ordering': "['-date_added']",
                'object_name': 'Photo'
            },
            'caption': ('django.db.models.fields.TextField', [], {
                'blank': 'True'
            }),
            'crop_from': ('django.db.models.fields.CharField', [], {
                'default': "'center'",
                'max_length': '10',
                'blank': 'True'
            }),
            'date_added': ('django.db.models.fields.DateTimeField', [], {
                'default': 'datetime.datetime.now'
            }),
            'date_taken': ('django.db.models.fields.DateTimeField', [], {
                'null': 'True',
                'blank': 'True'
            }),
            'effect': ('django.db.models.fields.related.ForeignKey', [], {
                'blank': 'True',
                'related_name': "'photo_related'",
                'null': 'True',
                'to': "orm['photologue.PhotoEffect']"
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'image': ('django.db.models.fields.files.ImageField', [], {
                'max_length': '100',
                'blank': 'True'
            }),
            'is_public': ('django.db.models.fields.BooleanField', [], {
                'default': 'True'
            }),
            'tags': ('photologue.models.TagField', [], {
                'max_length': '255',
                'blank': 'True'
            }),
            'title': ('django.db.models.fields.CharField', [], {
                'unique': 'True',
                'max_length': '100'
            }),
            'title_slug': ('django.db.models.fields.SlugField', [], {
                'unique': 'True',
                'max_length': '50'
            }),
            'view_count':
            ('django.db.models.fields.PositiveIntegerField', [], {
                'default': '0'
            })
        },
        'photologue.photoeffect': {
            'Meta': {
                'object_name': 'PhotoEffect'
            },
            'background_color': ('django.db.models.fields.CharField', [], {
                'default': "'#FFFFFF'",
                'max_length': '7'
            }),
            'brightness': ('django.db.models.fields.FloatField', [], {
                'default': '1.0'
            }),
            'color': ('django.db.models.fields.FloatField', [], {
                'default': '1.0'
            }),
            'contrast': ('django.db.models.fields.FloatField', [], {
                'default': '1.0'
            }),
            'description': ('django.db.models.fields.TextField', [], {
                'blank': 'True'
            }),
            'filters': ('django.db.models.fields.CharField', [], {
                'max_length': '200',
                'blank': 'True'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'name': ('django.db.models.fields.CharField', [], {
                'unique': 'True',
                'max_length': '30'
            }),
            'reflection_size': ('django.db.models.fields.FloatField', [], {
                'default': '0'
            }),
            'reflection_strength': ('django.db.models.fields.FloatField', [], {
                'default': '0.6'
            }),
            'sharpness': ('django.db.models.fields.FloatField', [], {
                'default': '1.0'
            }),
            'transpose_method': ('django.db.models.fields.CharField', [], {
                'max_length': '15',
                'blank': 'True'
            })
        },
        'publisher.publisher': {
            'Meta': {
                'object_name': 'Publisher'
            },
            'class_name': ('django.db.models.fields.CharField', [], {
                'max_length': '32',
                'null': 'True'
            }),
            'content_type':
            ('django.db.models.fields.related.ForeignKey', [], {
                'to': "orm['contenttypes.ContentType']",
                'null': 'True'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'title': ('django.db.models.fields.CharField', [], {
                'max_length': '64'
            })
        },
        'secretballot.vote': {
            'Meta': {
                'unique_together': "(('token', 'content_type', 'object_id'),)",
                'object_name': 'Vote'
            },
            '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', [], {}),
            'token': ('django.db.models.fields.CharField', [], {
                'max_length': '50'
            }),
            'vote': ('django.db.models.fields.SmallIntegerField', [], {})
        },
        'sites.site': {
            'Meta': {
                'ordering': "('domain',)",
                'object_name': 'Site',
                'db_table': "'django_site'"
            },
            'domain': ('django.db.models.fields.CharField', [], {
                'max_length': '100'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'name': ('django.db.models.fields.CharField', [], {
                'max_length': '50'
            })
        }
    }

    if USE_GIS:
        models.update({
            'atlas.city': {
                'Meta': {
                    'ordering': "('name',)",
                    'object_name': 'City'
                },
                'coordinates': ('atlas.fields.CoordinateField', [], {
                    'blank': 'True',
                    'null': 'True',
                    'geography': 'True'
                }),
                'country': ('django.db.models.fields.related.ForeignKey', [], {
                    'to': "orm['atlas.Country']"
                }),
                'id': ('django.db.models.fields.AutoField', [], {
                    'primary_key': 'True'
                }),
                'name': ('django.db.models.fields.CharField', [], {
                    'max_length': '128',
                    'db_index': 'True'
                }),
                'region': ('django.db.models.fields.related.ForeignKey', [], {
                    'to': "orm['atlas.Region']",
                    'null': 'True',
                    'blank': 'True'
                })
            },
            'atlas.country': {
                'Meta': {
                    'ordering': "('name',)",
                    'object_name': 'Country'
                },
                'border':
                ('django.contrib.gis.db.models.fields.MultiPolygonField', [], {
                    'blank': 'True',
                    'null': 'True',
                    'geography': 'True'
                }),
                'country_code': ('django.db.models.fields.CharField', [], {
                    'unique': 'True',
                    'max_length': '2',
                    'db_index': 'True'
                }),
                'id': ('django.db.models.fields.AutoField', [], {
                    'primary_key': 'True'
                }),
                'name': ('django.db.models.fields.CharField', [], {
                    'max_length': '50'
                })
            },
            'atlas.location': {
                'Meta': {
                    'object_name': 'Location'
                },
                'address': ('django.db.models.fields.TextField', [], {
                    'max_length': '512',
                    'null': 'True',
                    'blank': 'True'
                }),
                'city': ('django.db.models.fields.related.ForeignKey', [], {
                    'to': "orm['atlas.City']"
                }),
                'coordinates': ('atlas.fields.CoordinateField', [], {
                    'blank': 'True',
                    'null': 'True',
                    'geography': 'True'
                }),
                'country': ('django.db.models.fields.related.ForeignKey', [], {
                    'to': "orm['atlas.Country']"
                }),
                'description': ('django.db.models.fields.TextField', [], {
                    'max_length': '1024',
                    'null': 'True',
                    'blank': 'True'
                }),
                'id': ('django.db.models.fields.AutoField', [], {
                    'primary_key': 'True'
                }),
                'name': ('django.db.models.fields.CharField', [], {
                    'max_length': '128',
                    'db_index': 'True'
                }),
                'photo': ('django.db.models.fields.related.ForeignKey', [], {
                    'to': "orm['photologue.Photo']",
                    'null': 'True',
                    'blank': 'True'
                })
            },
            'atlas.region': {
                'Meta': {
                    'ordering': "('name',)",
                    'unique_together': "(('country', 'code'),)",
                    'object_name': 'Region'
                },
                'border':
                ('django.contrib.gis.db.models.fields.MultiPolygonField', [], {
                    'blank': 'True',
                    'null': 'True',
                    'geography': 'True'
                }),
                'code': ('django.db.models.fields.CharField', [], {
                    'max_length': '2',
                    'db_index': 'True'
                }),
                'country': ('django.db.models.fields.related.ForeignKey', [], {
                    'to': "orm['atlas.Country']"
                }),
                'id': ('django.db.models.fields.AutoField', [], {
                    'primary_key': 'True'
                }),
                'name': ('django.db.models.fields.CharField', [], {
                    'max_length': '128'
                })
            }
        })
        models['jmbo.modelbase']['location'] = (
            'django.db.models.fields.related.ForeignKey', [], {
                'to': "orm['atlas.Location']",
                'null': 'True',
                'blank': 'True'
            })

    complete_apps = ['jmbo']
示例#13
0
class Migration(BasePublishableDataMigration):
    models = dict.copy(BasePublishableDataMigration.models)
    models.update({
        'interviews.interview': {
            'Meta': {
                'ordering': "('-ask_from',)",
                '_bases': ['ella.core.models.publishable.Publishable']
            },
            'ask_from': ('models.DateTimeField', ["_('Ask from')"], {}),
            'ask_to': ('models.DateTimeField', ["_('Ask to')"], {}),
            'content': ('models.TextField', ["_('Text')"], {}),
            'interviewees':
            ('models.ManyToManyField', ["orm['interviews.Interviewee']"], {
                'verbose_name': "_('Interviewees')"
            }),
            'publishable_ptr':
            ('models.OneToOneField', ["orm['core.Publishable']"], {}),
            'reply_from': ('models.DateTimeField', ["_('Reply from')"], {}),
            'reply_to': ('models.DateTimeField', ["_('Reply to')"], {}),
            'upper_title': ('models.CharField', ["_('Upper title')"], {
                'max_length': '255',
                'blank': 'True'
            })
        },
        'interviews.interviewee': {
            'Meta': {
                'ordering': "('name',)"
            },
            'author': ('models.ForeignKey', ["orm['core.Author']"], {
                'null': 'True',
                'blank': 'True'
            }),
            'description': ('models.TextField', ["_('Description')"], {
                'blank': 'True'
            }),
            'id': ('models.AutoField', [], {
                'primary_key': 'True'
            }),
            'name': ('models.CharField', ["_('Name')"], {
                'max_length': '200',
                'blank': 'True'
            }),
            'slug': ('models.SlugField', ["_('Slug')"], {
                'max_length': '255'
            }),
            'user': ('models.ForeignKey', ["orm['auth.User']"], {
                'null': 'True',
                'blank': 'True'
            })
        },
        'auth.user': {
            '_stub': True,
            'id': ('models.AutoField', [], {
                'primary_key': 'True'
            })
        },
        'core.author': {
            'Meta': {
                'app_label': "'core'"
            },
            '_stub': True,
            'id': ('models.AutoField', [], {
                'primary_key': 'True'
            })
        },
    })

    app_label = 'interviews'
    model = 'interview'
    table = '%s_%s' % (app_label, model)

    publishable_uncommon_cols = {
        'source_id': 'source_id',
        'description': 'perex',
    }

    def alter_self_foreignkeys(self, orm):
        # migrate authors as in base
        super(Migration, self).alter_self_foreignkeys(orm)
        alter_foreignkey_to_int('interviews_question', 'interview')
        alter_foreignkey_to_int('interviews_interview_interviewees',
                                'interview')

    def move_self_foreignkeys(self, orm):
        # migrate authors as in base
        super(Migration, self).move_self_foreignkeys(orm)
        # migrate new article IDs to question
        migrate_foreignkey(self.app_label, self.model, 'interviews_question',
                           self.model, self.orm)
        # migrate new article IDs to interview_interviewees
        migrate_foreignkey(self.app_label, self.model,
                           'interviews_interview_interviewees', self.model,
                           self.orm)
示例#14
0
class Migration(SchemaMigration):
    depends_on = DEPENDS_ON_CUSTOM_USER_MIGRATION

    def forwards(self, orm):

        # Adding model 'Post'
        db.create_table('noticeapp_post', (
            ('id',
             self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('body', self.gf('django.db.models.fields.TextField')()),
            ('body_html', self.gf('django.db.models.fields.TextField')()),
            ('body_text', self.gf('django.db.models.fields.TextField')()),
            ('course', self.gf('django.db.models.fields.related.ForeignKey')(
                related_name='posts', to=orm['noticeapp.Course'])),
            ('user', self.gf('django.db.models.fields.related.ForeignKey')(
                related_name='posts', to=orm[AUTH_USER])),
            ('created', self.gf('django.db.models.fields.DateTimeField')(
                db_index=True, blank=True)),
            ('updated', self.gf('django.db.models.fields.DateTimeField')(
                null=True, blank=True)),
            ('user_ip', self.gf('django.db.models.fields.IPAddressField')(
                default='0.0.0.0', max_length=15, blank=True)),
            ('markup',
             self.gf('django.db.models.fields.CharField')(max_length=15)),
        ))
        db.send_create_signal('noticeapp', ['Post'])

        # Adding model 'Category'
        db.create_table('noticeapp_category', (
            ('id',
             self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name',
             self.gf('django.db.models.fields.CharField')(max_length=80)),
            ('position', self.gf('django.db.models.fields.IntegerField')(
                default=0, blank=True)),
        ))
        db.send_create_signal('noticeapp', ['Category'])

        # Adding model 'Notice'
        db.create_table('noticeapp_notice', (
            ('id',
             self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('category', self.gf('django.db.models.fields.related.ForeignKey')(
                related_name='notices', to=orm['noticeapp.Category'])),
            ('name',
             self.gf('django.db.models.fields.CharField')(max_length=80)),
            ('position', self.gf('django.db.models.fields.IntegerField')(
                default=0, blank=True)),
            ('description',
             self.gf('django.db.models.fields.TextField')(blank=True)),
            ('updated', self.gf('django.db.models.fields.DateTimeField')(
                null=True, blank=True)),
            ('post_count', self.gf('django.db.models.fields.IntegerField')(
                default=0, blank=True)),
            ('course_count', self.gf('django.db.models.fields.IntegerField')(
                default=0, blank=True)),
        ))
        db.send_create_signal('noticeapp', ['Notice'])

        # Adding model 'Profile'
        db.create_table('noticeapp_profile', (
            ('id',
             self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('signature', self.gf('django.db.models.fields.TextField')(
                max_length=1024, blank=True)),
            ('signature_html', self.gf('django.db.models.fields.TextField')(
                max_length=1054, blank=True)),
            ('time_zone',
             self.gf('django.db.models.fields.FloatField')(default=3.0)),
            ('language', self.gf('django.db.models.fields.CharField')(
                default='en-us', max_length=10, blank=True)),
            ('show_signatures',
             self.gf('django.db.models.fields.BooleanField')(default=True)),
            ('post_count', self.gf('django.db.models.fields.IntegerField')(
                default=0, blank=True)),
            ('avatar', self.gf(get_image_field_full_name())(
                max_length=100, null=True, blank=True)),
            ('user', self.gf('annoying.fields.AutoOneToOneField')(
                related_name='noticeapp_profile',
                unique=True,
                to=orm[AUTH_USER])),
            ('markup',
             self.gf('django.db.models.fields.CharField')(max_length=15)),
            ('ban_status',
             self.gf('django.db.models.fields.SmallIntegerField')(default=0)),
            ('ban_till', self.gf('django.db.models.fields.DateTimeField')(
                default=None, null=True, blank=True)),
        ))
        db.send_create_signal('noticeapp', ['Profile'])

        # Adding model 'Attachment'
        db.create_table('noticeapp_attachment', (
            ('id',
             self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('post', self.gf('django.db.models.fields.related.ForeignKey')(
                related_name='attachments', to=orm['noticeapp.Post'])),
            ('size', self.gf('django.db.models.fields.IntegerField')()),
            ('hash', self.gf('django.db.models.fields.CharField')(
                blank=True, default='', max_length=40, db_index=True)),
            ('content_type',
             self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('name', self.gf('django.db.models.fields.TextField')()),
            ('path',
             self.gf('django.db.models.fields.CharField')(max_length=255)),
        ))
        db.send_create_signal('noticeapp', ['Attachment'])

        # Adding model 'ReadTracking'
        db.create_table('noticeapp_readtracking', (
            ('id',
             self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('user', self.gf('django.db.models.fields.related.ForeignKey')(
                to=orm[AUTH_USER])),
            ('courses',
             self.gf('django.db.models.fields.TextField')(null=True)),
            ('last_read',
             self.gf('django.db.models.fields.DateTimeField')(null=True)),
        ))
        db.send_create_signal('noticeapp', ['ReadTracking'])

        # Adding model 'Course'
        db.create_table('noticeapp_course', (
            ('id',
             self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('notice', self.gf('django.db.models.fields.related.ForeignKey')(
                related_name='courses', to=orm['noticeapp.Notice'])),
            ('name',
             self.gf('django.db.models.fields.CharField')(max_length=255)),
            ('created',
             self.gf('django.db.models.fields.DateTimeField')(null=True)),
            ('updated',
             self.gf('django.db.models.fields.DateTimeField')(null=True)),
            ('user', self.gf('django.db.models.fields.related.ForeignKey')(
                to=orm[AUTH_USER])),
            ('views', self.gf('django.db.models.fields.IntegerField')(
                default=0, blank=True)),
            ('sticky',
             self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('closed',
             self.gf('django.db.models.fields.BooleanField')(default=False)),
            ('post_count', self.gf('django.db.models.fields.IntegerField')(
                default=0, blank=True)),
        ))
        db.send_create_signal('noticeapp', ['Course'])

        # Adding M2M table for field subscribers on 'Course'
        db.create_table(
            'noticeapp_course_subscribers',
            (('id',
              models.AutoField(
                  verbose_name='ID', primary_key=True, auto_created=True)),
             ('course', models.ForeignKey(orm['noticeapp.course'],
                                          null=False)),
             (AUTH_USER_COLUMN, models.ForeignKey(orm[AUTH_USER],
                                                  null=False))))
        db.create_unique('noticeapp_course_subscribers',
                         ['course_id', '%s_id' % AUTH_USER_COLUMN])

        # Adding M2M table for field moderators on 'Notice'
        db.create_table(
            'noticeapp_notice_moderators',
            (('id',
              models.AutoField(
                  verbose_name='ID', primary_key=True, auto_created=True)),
             ('notice', models.ForeignKey(orm['noticeapp.notice'],
                                          null=False)),
             (AUTH_USER_COLUMN, models.ForeignKey(orm[AUTH_USER],
                                                  null=False))))
        db.create_unique('noticeapp_notice_moderators',
                         ['notice_id', '%s_id' % AUTH_USER_COLUMN])

    def backwards(self, orm):

        # Deleting model 'Post'
        db.delete_table('noticeapp_post')

        # Deleting model 'Category'
        db.delete_table('noticeapp_category')

        # Deleting model 'Notice'
        db.delete_table('noticeapp_notice')

        # Deleting model 'Profile'
        db.delete_table('noticeapp_profile')

        # Deleting model 'Attachment'
        db.delete_table('noticeapp_attachment')

        # Deleting model 'ReadTracking'
        db.delete_table('noticeapp_readtracking')

        # Deleting model 'Course'
        db.delete_table('noticeapp_course')

        # Dropping ManyToManyField 'Course.subscribers'
        db.delete_table('noticeapp_course_subscribers')

        # Dropping ManyToManyField 'Notice.moderators'
        db.delete_table('noticeapp_notice_moderators')

    models = {
        'auth.group': {
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'name': ('django.db.models.fields.CharField', [], {
                'max_length': '80',
                'unique': 'True'
            }),
            'permissions':
            ('django.db.models.fields.related.ManyToManyField', [], {
                'to': "orm['auth.Permission']",
                'blank': 'True'
            })
        },
        'auth.permission': {
            'Meta': {
                'unique_together': "(('content_type', 'codename'),)"
            },
            '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'
            })
        },
        'contenttypes.contenttype': {
            'Meta': {
                'unique_together': "(('app_label', 'model'),)",
                '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'
            })
        },
        'noticeapp.attachment': {
            'content_type': ('django.db.models.fields.CharField', [], {
                'max_length': '255'
            }),
            'hash': ('django.db.models.fields.CharField', [], {
                'db_index': 'True',
                'max_length': '40',
                'blank': 'True'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'name': ('django.db.models.fields.TextField', [], {}),
            'path': ('django.db.models.fields.CharField', [], {
                'max_length': '255'
            }),
            'post': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'attachments'",
                'to': "orm['noticeapp.Post']"
            }),
            'size': ('django.db.models.fields.IntegerField', [], {})
        },
        'noticeapp.category': {
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'name': ('django.db.models.fields.CharField', [], {
                'max_length': '80'
            }),
            'position': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            })
        },
        'noticeapp.notice': {
            'category': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'notices'",
                'to': "orm['noticeapp.Category']"
            }),
            'description': ('django.db.models.fields.TextField', [], {
                'blank': 'True'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'moderators':
            ('django.db.models.fields.related.ManyToManyField', [], {
                'to': "orm['%s']" % AUTH_USER,
                'null': 'True',
                'blank': 'True'
            }),
            'name': ('django.db.models.fields.CharField', [], {
                'max_length': '80'
            }),
            'position': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            }),
            'post_count': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            }),
            'course_count': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            }),
            'updated': ('django.db.models.fields.DateTimeField', [], {
                'null': 'True',
                'blank': 'True'
            })
        },
        'noticeapp.post': {
            'body': ('django.db.models.fields.TextField', [], {}),
            'body_html': ('django.db.models.fields.TextField', [], {}),
            'body_text': ('django.db.models.fields.TextField', [], {}),
            'created': ('django.db.models.fields.DateTimeField', [], {
                'blank': 'True'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'markup': ('django.db.models.fields.CharField', [], {
                'default': "'bbcode'",
                'max_length': '15'
            }),
            'course': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'posts'",
                'to': "orm['noticeapp.Course']"
            }),
            'updated': ('django.db.models.fields.DateTimeField', [], {
                'null': 'True',
                'blank': 'True'
            }),
            'user': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'posts'",
                'to': "orm['%s']" % AUTH_USER
            }),
            'user_ip': ('django.db.models.fields.IPAddressField', [], {
                'default': "'0.0.0.0'",
                'max_length': '15',
                'blank': 'True'
            })
        },
        'noticeapp.profile': {
            'avatar': ('django.db.models.fields.files.ImageField', [], {
                'max_length': '100',
                'blank': 'True'
            }),
            'ban_status': ('django.db.models.fields.SmallIntegerField', [], {
                'default': '0'
            }),
            'ban_till': ('django.db.models.fields.DateTimeField', [], {
                'default': 'None',
                'null': 'True',
                'blank': 'True'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'language': ('django.db.models.fields.CharField', [], {
                'max_length': '10',
                'blank': 'True'
            }),
            'markup': ('django.db.models.fields.CharField', [], {
                'default': "'bbcode'",
                'max_length': '15'
            }),
            'post_count': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            }),
            'show_signatures': ('django.db.models.fields.BooleanField', [], {
                'default': 'True',
                'blank': 'True'
            }),
            'signature': ('django.db.models.fields.TextField', [], {
                'max_length': '1024',
                'blank': 'True'
            }),
            'signature_html': ('django.db.models.fields.TextField', [], {
                'max_length': '1054',
                'blank': 'True'
            }),
            'time_zone': ('django.db.models.fields.FloatField', [], {
                'default': '3.0'
            }),
            'user': ('django.db.models.fields.related.OneToOneField', [], {
                'to': "orm['%s']" % AUTH_USER,
                'related_name': "'noticeapp_profile'",
                'unique': 'True'
            })
        },
        'noticeapp.readtracking': {
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'last_read': ('django.db.models.fields.DateTimeField', [], {
                'null': 'True'
            }),
            'courses': ('django.db.models.fields.TextField', [], {
                'null': 'True'
            }),
            'user': ('django.db.models.fields.related.OneToOneField', [], {
                'unique': 'True',
                'to': "orm['%s']" % AUTH_USER
            })
        },
        'noticeapp.course': {
            'closed': ('django.db.models.fields.BooleanField', [], {
                'default': 'False',
                'blank': 'True'
            }),
            'created': ('django.db.models.fields.DateTimeField', [], {
                'null': 'True'
            }),
            'notice': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'courses'",
                'to': "orm['noticeapp.Notice']"
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'name': ('django.db.models.fields.CharField', [], {
                'max_length': '255'
            }),
            'post_count': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            }),
            'sticky': ('django.db.models.fields.BooleanField', [], {
                'default': 'False',
                'blank': 'True'
            }),
            'subscribers':
            ('django.db.models.fields.related.ManyToManyField', [], {
                'to': "orm['%s']" % AUTH_USER,
                'blank': 'True'
            }),
            'updated': ('django.db.models.fields.DateTimeField', [], {
                'blank': 'True',
                'null': 'True'
            }),
            'user': ('django.db.models.fields.related.ForeignKey', [], {
                'to': "orm['%s']" % AUTH_USER
            }),
            'views': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            })
        }
    }
    models.update(get_user_frozen_models(AUTH_USER))

    complete_apps = ['noticeapp']
示例#15
0
class Migration(SchemaMigration):
    def forwards(self, orm):
        if AUTH_USER == 'test_app.CustomUser':
            # Adding model 'CustomUser'
            db.create_table('test_app_customuser', (
                ('id', self.gf('django.db.models.fields.AutoField')(
                    primary_key=True)),
                ('password',
                 self.gf('django.db.models.fields.CharField')(max_length=128)),
                ('last_login',
                 self.gf('django.db.models.fields.DateTimeField')(
                     default=datetime.datetime.now)),
                ('is_superuser',
                 self.gf('django.db.models.fields.BooleanField')(
                     default=False)),
                ('username', self.gf('django.db.models.fields.CharField')(
                    unique=True, max_length=100)),
                ('email',
                 self.gf('django.db.models.fields.EmailField')(max_length=75)),
                ('is_staff', self.gf('django.db.models.fields.BooleanField')(
                    default=False)),
                ('is_active', self.gf('django.db.models.fields.BooleanField')(
                    default=True)),
                ('date_joined',
                 self.gf('django.db.models.fields.DateTimeField')(
                     default=datetime.datetime.now)),
            ))
            db.send_create_signal('test_app', ['CustomUser'])

            # Adding M2M table for field groups on 'CustomUser'
            m2m_table_name = db.shorten_name('test_app_customuser_groups')
            db.create_table(
                m2m_table_name,
                (('id',
                  models.AutoField(
                      verbose_name='ID', primary_key=True, auto_created=True)),
                 ('customuser',
                  models.ForeignKey(orm['test_app.customuser'], null=False)),
                 ('group', models.ForeignKey(orm['auth.group'], null=False))))
            db.create_unique(m2m_table_name, ['customuser_id', 'group_id'])

            # Adding M2M table for field user_permissions on 'CustomUser'
            m2m_table_name = db.shorten_name(
                'test_app_customuser_user_permissions')
            db.create_table(
                m2m_table_name,
                (('id',
                  models.AutoField(
                      verbose_name='ID', primary_key=True, auto_created=True)),
                 ('customuser',
                  models.ForeignKey(orm['test_app.customuser'], null=False)),
                 ('permission',
                  models.ForeignKey(orm['auth.permission'], null=False))))
            db.create_unique(m2m_table_name,
                             ['customuser_id', 'permission_id'])

        # Adding model 'CustomProfile'
        db.create_table('test_app_customprofile', (
            ('id',
             self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('signature', self.gf('django.db.models.fields.TextField')(
                max_length=1024, blank=True)),
            ('signature_html', self.gf('django.db.models.fields.TextField')(
                max_length=1054, blank=True)),
            ('time_zone',
             self.gf('django.db.models.fields.FloatField')(default=3.0)),
            ('language', self.gf('django.db.models.fields.CharField')(
                default='en-us', max_length=10, blank=True)),
            ('show_signatures',
             self.gf('django.db.models.fields.BooleanField')(default=True)),
            ('post_count', self.gf('django.db.models.fields.IntegerField')(
                default=0, blank=True)),
            ('avatar', self.gf(get_image_field_full_name())(
                max_length=100, null=True, blank=True)),
            ('autosubscribe',
             self.gf('django.db.models.fields.BooleanField')(default=True)),
            ('user', self.gf('django.db.models.fields.related.OneToOneField')(
                related_name='pybb_customprofile',
                unique=True,
                to=orm[AUTH_USER])),
        ))
        db.send_create_signal('test_app', ['CustomProfile'])

    def backwards(self, orm):
        if AUTH_USER == 'test_app.CustomUser':
            # Deleting model 'CustomUser'
            db.delete_table('test_app_customuser')

            # Removing M2M table for field groups on 'CustomUser'
            db.delete_table(db.shorten_name('test_app_customuser_groups'))

            # Removing M2M table for field user_permissions on 'CustomUser'
            db.delete_table(
                db.shorten_name('test_app_customuser_user_permissions'))

        # Deleting model 'CustomProfile'
        db.delete_table('test_app_customprofile')

    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'
            })
        },
        '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'
            })
        },
        'test_app.customprofile': {
            'Meta': {
                'object_name': 'CustomProfile'
            },
            'autosubscribe': ('django.db.models.fields.BooleanField', [], {
                'default': 'True'
            }),
            'avatar': (get_image_field_full_name(), [], {
                'max_length': '100',
                'null': 'True',
                'blank': 'True'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'language': ('django.db.models.fields.CharField', [], {
                'default': "'en-us'",
                'max_length': '10',
                'blank': 'True'
            }),
            'post_count': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            }),
            'show_signatures': ('django.db.models.fields.BooleanField', [], {
                'default': 'True'
            }),
            'signature': ('django.db.models.fields.TextField', [], {
                'max_length': '1024',
                'blank': 'True'
            }),
            'signature_html': ('django.db.models.fields.TextField', [], {
                'max_length': '1054',
                'blank': 'True'
            }),
            'time_zone': ('django.db.models.fields.FloatField', [], {
                'default': '3.0'
            }),
            'user': ('django.db.models.fields.related.OneToOneField', [], {
                'related_name': "'pybb_customprofile'",
                'unique': 'True',
                'to': "orm['%s']" % AUTH_USER
            })
        },
    }

    if AUTH_USER == 'test_app.CustomUser':
        models['test_app.customuser'] = {
            'Meta': {
                'object_name': 'CustomUser'
            },
            'date_joined': ('django.db.models.fields.DateTimeField', [], {
                'default': 'datetime.datetime.now'
            }),
            'email': ('django.db.models.fields.EmailField', [], {
                'max_length': '75'
            }),
            'groups': ('django.db.models.fields.related.ManyToManyField', [], {
                'symmetrical': 'False',
                'related_name': "'user_set'",
                'blank': 'True',
                'to': "orm['auth.Group']"
            }),
            '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'
            }),
            'password': ('django.db.models.fields.CharField', [], {
                'max_length': '128'
            }),
            'user_permissions':
            ('django.db.models.fields.related.ManyToManyField', [], {
                'symmetrical': 'False',
                'related_name': "'user_set'",
                'blank': 'True',
                'to': "orm['auth.Permission']"
            }),
            'username': ('django.db.models.fields.CharField', [], {
                'unique': 'True',
                'max_length': '100'
            })
        }
    else:
        models.update(get_user_frozen_models(AUTH_USER))
    complete_apps = ['test_app']
示例#16
0
class Migration(BasePublishableDataMigration):
    # TODO:
    # this is only temporary, it should be constructed dynamically
    # from each migration in installed_apps, that contains run_before
    _depends_on = (('jaknato.instruction', 'instruction', '0001_initial'), )
    depends_on = []
    for app, label, migration in _depends_on:
        if app in settings.INSTALLED_APPS:
            depends_on.append((label, migration))

    models = dict.copy(BasePublishableDataMigration.models)
    models.update({
        'media.media': {
            'Meta': {
                '_bases': ['ella.core.models.publishable.Publishable']
            },
            'created': ('models.DateTimeField', ["_('Created')"], {
                'default': 'datetime.datetime.now',
                'editable': 'False'
            }),
            'file': ('MediaField', [], {}),
            'publishable_ptr':
            ('models.OneToOneField', ["orm['core.Publishable']"], {}),
            'text': ('models.TextField', ["_('Content')"], {
                'blank': 'True'
            }),
            'updated': ('models.DateTimeField', ["_('Updated')"], {
                'null': 'True',
                'blank': 'True'
            })
        },
    })

    app_label = 'media'
    model = 'media'
    table = '%s_%s' % (app_label, model)

    publishable_uncommon_cols = {
        'source_id': 'source_id',
        'description': 'description',
    }

    def alter_self_foreignkeys(self, orm):
        # migrate authors as in base
        super(Migration, self).alter_self_foreignkeys(orm)
        alter_foreignkey_to_int('media_section', 'media')
        alter_foreignkey_to_int('media_usage', 'media')
        if 'jaknato.instruction' in settings.INSTALLED_APPS:
            # TODO: this should be solved via plugins
            alter_foreignkey_to_int('instruction_instruction', 'media')

    def move_self_foreignkeys(self, orm):
        # migrate authors as in base
        super(Migration, self).move_self_foreignkeys(orm)
        # migrate new media IDs to section
        migrate_foreignkey(self.app_label, self.model, 'media_section',
                           self.model, self.orm)
        # migrate new media IDs to usage
        migrate_foreignkey(self.app_label, self.model, 'media_usage',
                           self.model, self.orm)
        if 'jaknato.instruction' in settings.INSTALLED_APPS:
            # TODO: this should be solved via plugins
            migrate_foreignkey(self.app_label, self.model,
                               'instruction_instruction', self.model, self.orm)
class Migration(SchemaMigration):

    def forwards(self, orm):
        # Adding unique constraint on 'CourseReadTracker', fields ['course', 'user']
        db.create_unique('noticeapp_coursereadtracker', ['course_id', 'user_id'])

        # Adding unique constraint on 'NoticeReadTracker', fields ['user', 'notice']
        db.create_unique('noticeapp_noticereadtracker', ['user_id', 'notice_id'])


    def backwards(self, orm):
        # Removing unique constraint on 'NoticeReadTracker', fields ['user', 'notice']
        db.delete_unique('noticeapp_noticereadtracker', ['user_id', 'notice_id'])

        # Removing unique constraint on 'CourseReadTracker', fields ['course', 'user']
        db.delete_unique('noticeapp_coursereadtracker', ['course_id', 'user_id'])


    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'})
        },
        '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'})
        },
        'noticeapp.attachment': {
            'Meta': {'object_name': 'Attachment'},
            'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'post': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'attachments'", 'to': "orm['noticeapp.Post']"}),
            'size': ('django.db.models.fields.IntegerField', [], {})
        },
        'noticeapp.category': {
            'Meta': {'ordering': "['position']", 'object_name': 'Category'},
            'hidden': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '80'}),
            'position': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'})
        },
        'noticeapp.notice': {
            'Meta': {'ordering': "['position']", 'object_name': 'Notice'},
            'category': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'notices'", 'to': "orm['noticeapp.Category']"}),
            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
            'headline': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
            'hidden': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'moderators': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['%s']"% AUTH_USER, 'null': 'True', 'blank': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '80'}),
            'position': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}),
            'post_count': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}),
            'readed_by': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'readed_notices'", 'symmetrical': 'False', 'through': "orm['noticeapp.NoticeReadTracker']", 'to': "orm['%s']"% AUTH_USER}),
            'course_count': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}),
            'updated': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'})
        },
        'noticeapp.noticereadtracker': {
            'Meta': {'unique_together': "(('user', 'notice'),)", 'object_name': 'NoticeReadTracker'},
            'notice': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['noticeapp.Notice']", 'null': 'True', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'time_stamp': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
            'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['%s']"% AUTH_USER})
        },
        'noticeapp.pollanswer': {
            'Meta': {'object_name': 'PollAnswer'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'text': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'course': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'poll_answers'", 'to': "orm['noticeapp.Course']"})
        },
        'noticeapp.pollansweruser': {
            'Meta': {'unique_together': "(('poll_answer', 'user'),)", 'object_name': 'PollAnswerUser'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'poll_answer': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'users'", 'to': "orm['noticeapp.PollAnswer']"}),
            'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
            'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'poll_answers'", 'to': "orm['%s']"% AUTH_USER})
        },
        'noticeapp.post': {
            'Meta': {'ordering': "['created']", 'object_name': 'Post'},
            'body': ('django.db.models.fields.TextField', [], {}),
            'body_html': ('django.db.models.fields.TextField', [], {}),
            'body_text': ('django.db.models.fields.TextField', [], {}),
            'created': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'on_moderation': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'course': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'posts'", 'to': "orm['noticeapp.Course']"}),
            'updated': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
            'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'posts'", 'to': "orm['%s']"% AUTH_USER}),
            'user_ip': ('django.db.models.fields.IPAddressField', [], {'default': "'0.0.0.0'", 'max_length': '15', 'blank': 'True'})
        },
        'noticeapp.profile': {
            'Meta': {'object_name': 'Profile'},
            'autosubscribe': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
            'avatar': (get_image_field_full_name(), [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'language': ('django.db.models.fields.CharField', [], {'default': "'en-us'", 'max_length': '10', 'blank': 'True'}),
            'post_count': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}),
            'show_signatures': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
            'signature': ('django.db.models.fields.TextField', [], {'max_length': '1024', 'blank': 'True'}),
            'signature_html': ('django.db.models.fields.TextField', [], {'max_length': '1054', 'blank': 'True'}),
            'time_zone': ('django.db.models.fields.FloatField', [], {'default': '3.0'}),
            'user': ('annoying.fields.AutoOneToOneField', [], {'related_name': "'noticeapp_profile'", 'unique': 'True', 'to': "orm['%s']"% AUTH_USER})
        },
        'noticeapp.course': {
            'Meta': {'ordering': "['-created']", 'object_name': 'Course'},
            'closed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'created': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
            'notice': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'courses'", 'to': "orm['noticeapp.Notice']"}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
            'on_moderation': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'poll_question': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
            'poll_type': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'post_count': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'}),
            'readed_by': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'readed_courses'", 'symmetrical': 'False', 'through': "orm['noticeapp.CourseReadTracker']", 'to': "orm['%s']"% AUTH_USER}),
            'sticky': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'subscribers': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'subscriptions'", 'blank': 'True', 'to': "orm['%s']"% AUTH_USER}),
            'updated': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
            'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['%s']"% AUTH_USER}),
            'views': ('django.db.models.fields.IntegerField', [], {'default': '0', 'blank': 'True'})
        },
        'noticeapp.coursereadtracker': {
            'Meta': {'unique_together': "(('user', 'course'),)", 'object_name': 'CourseReadTracker'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'time_stamp': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
            'course': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['noticeapp.Course']", 'null': 'True', 'blank': 'True'}),
            'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['%s']"% AUTH_USER})
        }
    }
    models.update(get_user_frozen_models(AUTH_USER))

    complete_apps = ['noticeapp']
class Migration(DataMigration):
    def forwards(self, orm):
        try:
            add_post_permission = orm['auth.Permission'].objects.get(
                codename='add_post', content_type__name='Post')
            add_course_permission = orm['auth.Permission'].objects.get(
                codename='add_course', content_type__name='Course')
        except orm['auth.Permission'].DoesNotExist:
            return  # Testing mode?
        for user in orm[AUTH_USER].objects.all():
            user.user_permissions.add(add_post_permission,
                                      add_course_permission)
            user.save()

    def backwards(self, orm):
        "Write your backwards methods here."

    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'
            })
        },
        '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'
            })
        },
        'noticeapp.attachment': {
            'Meta': {
                'object_name': 'Attachment'
            },
            'content_type': ('django.db.models.fields.CharField', [], {
                'max_length': '255'
            }),
            'hash': ('django.db.models.fields.CharField', [], {
                'db_index': 'True',
                'max_length': '40',
                'blank': 'True'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'name': ('django.db.models.fields.TextField', [], {}),
            'path': ('django.db.models.fields.CharField', [], {
                'max_length': '255'
            }),
            'post': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'attachments'",
                'to': "orm['noticeapp.Post']"
            }),
            'size': ('django.db.models.fields.IntegerField', [], {})
        },
        'noticeapp.category': {
            'Meta': {
                'ordering': "['position']",
                'object_name': 'Category'
            },
            'hidden': ('django.db.models.fields.BooleanField', [], {
                'default': 'False'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'name': ('django.db.models.fields.CharField', [], {
                'max_length': '80'
            }),
            'position': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            })
        },
        'noticeapp.notice': {
            'Meta': {
                'ordering': "['position']",
                'object_name': 'Notice'
            },
            'category': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'notices'",
                'to': "orm['noticeapp.Category']"
            }),
            'description': ('django.db.models.fields.TextField', [], {
                'blank': 'True'
            }),
            'hidden': ('django.db.models.fields.BooleanField', [], {
                'default': 'False'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'moderators':
            ('django.db.models.fields.related.ManyToManyField', [], {
                'symmetrical': 'False',
                'to': "orm['%s']" % AUTH_USER,
                'null': 'True',
                'blank': 'True'
            }),
            'name': ('django.db.models.fields.CharField', [], {
                'max_length': '80'
            }),
            'position': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            }),
            'post_count': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            }),
            'readed_by':
            ('django.db.models.fields.related.ManyToManyField', [], {
                'related_name': "'readed_notices'",
                'symmetrical': 'False',
                'through': "orm['noticeapp.NoticeReadTracker']",
                'to': "orm['%s']" % AUTH_USER
            }),
            'course_count': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            }),
            'updated': ('django.db.models.fields.DateTimeField', [], {
                'null': 'True',
                'blank': 'True'
            })
        },
        'noticeapp.noticereadtracker': {
            'Meta': {
                'object_name': 'NoticeReadTracker'
            },
            'notice': ('django.db.models.fields.related.ForeignKey', [], {
                'to': "orm['noticeapp.Notice']",
                'null': 'True',
                'blank': 'True'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'time_stamp': ('django.db.models.fields.DateTimeField', [], {
                'auto_now': 'True',
                'blank': 'True'
            }),
            'user': ('django.db.models.fields.related.ForeignKey', [], {
                'to': "orm['%s']" % AUTH_USER
            })
        },
        'noticeapp.post': {
            'Meta': {
                'ordering': "['created']",
                'object_name': 'Post'
            },
            'body': ('django.db.models.fields.TextField', [], {}),
            'body_html': ('django.db.models.fields.TextField', [], {}),
            'body_text': ('django.db.models.fields.TextField', [], {}),
            'created': ('django.db.models.fields.DateTimeField', [], {
                'blank': 'True'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'markup': ('django.db.models.fields.CharField', [], {
                'default': "'bbcode'",
                'max_length': '15'
            }),
            'course': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'posts'",
                'to': "orm['noticeapp.Course']"
            }),
            'updated': ('django.db.models.fields.DateTimeField', [], {
                'null': 'True',
                'blank': 'True'
            }),
            'user': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'posts'",
                'to': "orm['%s']" % AUTH_USER
            }),
            'user_ip': ('django.db.models.fields.IPAddressField', [], {
                'default': "'0.0.0.0'",
                'max_length': '15',
                'blank': 'True'
            })
        },
        'noticeapp.profile': {
            'Meta': {
                'object_name': 'Profile'
            },
            'avatar': (get_image_field_full_name(), [], {
                'max_length': '100',
                'null': 'True',
                'blank': 'True'
            }),
            'ban_status': ('django.db.models.fields.SmallIntegerField', [], {
                'default': '0'
            }),
            'ban_till': ('django.db.models.fields.DateTimeField', [], {
                'default': 'None',
                'null': 'True',
                'blank': 'True'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'language': ('django.db.models.fields.CharField', [], {
                'max_length': '10',
                'blank': 'True'
            }),
            'markup': ('django.db.models.fields.CharField', [], {
                'default': "'bbcode'",
                'max_length': '15'
            }),
            'post_count': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            }),
            'show_signatures': ('django.db.models.fields.BooleanField', [], {
                'default': 'True'
            }),
            'signature': ('django.db.models.fields.TextField', [], {
                'max_length': '1024',
                'blank': 'True'
            }),
            'signature_html': ('django.db.models.fields.TextField', [], {
                'max_length': '1054',
                'blank': 'True'
            }),
            'time_zone': ('django.db.models.fields.FloatField', [], {
                'default': '3.0'
            }),
            'user': ('annoying.fields.AutoOneToOneField', [], {
                'related_name': "'noticeapp_profile'",
                'unique': 'True',
                'to': "orm['%s']" % AUTH_USER
            })
        },
        'noticeapp.course': {
            'Meta': {
                'ordering': "['-created']",
                'object_name': 'Course'
            },
            'closed': ('django.db.models.fields.BooleanField', [], {
                'default': 'False'
            }),
            'created': ('django.db.models.fields.DateTimeField', [], {
                'null': 'True'
            }),
            'notice': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'courses'",
                'to': "orm['noticeapp.Notice']"
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'name': ('django.db.models.fields.CharField', [], {
                'max_length': '255'
            }),
            'post_count': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            }),
            'readed_by':
            ('django.db.models.fields.related.ManyToManyField', [], {
                'related_name': "'readed_courses'",
                'symmetrical': 'False',
                'through': "orm['noticeapp.CourseReadTracker']",
                'to': "orm['%s']" % AUTH_USER
            }),
            'sticky': ('django.db.models.fields.BooleanField', [], {
                'default': 'False'
            }),
            'subscribers':
            ('django.db.models.fields.related.ManyToManyField', [], {
                'symmetrical': 'False',
                'related_name': "'subscriptions'",
                'blank': 'True',
                'to': "orm['%s']" % AUTH_USER
            }),
            'updated': ('django.db.models.fields.DateTimeField', [], {
                'null': 'True'
            }),
            'user': ('django.db.models.fields.related.ForeignKey', [], {
                'to': "orm['%s']" % AUTH_USER
            }),
            'views': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            })
        },
        'noticeapp.coursereadtracker': {
            'Meta': {
                'object_name': 'CourseReadTracker'
            },
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'time_stamp': ('django.db.models.fields.DateTimeField', [], {
                'auto_now': 'True',
                'blank': 'True'
            }),
            'course': ('django.db.models.fields.related.ForeignKey', [], {
                'to': "orm['noticeapp.Course']",
                'null': 'True',
                'blank': 'True'
            }),
            'user': ('django.db.models.fields.related.ForeignKey', [], {
                'to': "orm['%s']" % AUTH_USER
            })
        }
    }
    models.update(get_user_frozen_models(AUTH_USER))

    complete_apps = ['noticeapp']
示例#19
0
class Migration(SchemaMigration):
    def forwards(self, orm):

        # Adding field 'Category.hidden'
        db.add_column(
            'pybb_category',
            'hidden',
            self.gf('django.db.models.fields.BooleanField')(default=False),
            keep_default=False)

        # Adding field 'Forum.hidden'
        db.add_column(
            'pybb_forum',
            'hidden',
            self.gf('django.db.models.fields.BooleanField')(default=False),
            keep_default=False)

    def backwards(self, orm):

        # Deleting field 'Category.hidden'
        db.delete_column('pybb_category', 'hidden')

        # Deleting field 'Forum.hidden'
        db.delete_column('pybb_forum', 'hidden')

    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'
            })
        },
        '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'
            })
        },
        'pybb.attachment': {
            'Meta': {
                'object_name': 'Attachment'
            },
            'content_type': ('django.db.models.fields.CharField', [], {
                'max_length': '255'
            }),
            'hash': ('django.db.models.fields.CharField', [], {
                'db_index': 'True',
                'max_length': '40',
                'blank': 'True'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'name': ('django.db.models.fields.TextField', [], {}),
            'path': ('django.db.models.fields.CharField', [], {
                'max_length': '255'
            }),
            'post': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'attachments'",
                'to': "orm['pybb.Post']"
            }),
            'size': ('django.db.models.fields.IntegerField', [], {})
        },
        'pybb.category': {
            'Meta': {
                'ordering': "['position']",
                'object_name': 'Category'
            },
            'hidden': ('django.db.models.fields.BooleanField', [], {
                'default': 'False'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'name': ('django.db.models.fields.CharField', [], {
                'max_length': '80'
            }),
            'position': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            })
        },
        'pybb.forum': {
            'Meta': {
                'ordering': "['position']",
                'object_name': 'Forum'
            },
            'category': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'forums'",
                'to': "orm['pybb.Category']"
            }),
            'description': ('django.db.models.fields.TextField', [], {
                'blank': 'True'
            }),
            'hidden': ('django.db.models.fields.BooleanField', [], {
                'default': 'False'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'moderators':
            ('django.db.models.fields.related.ManyToManyField', [], {
                'symmetrical': 'False',
                'to': "orm['%s']" % AUTH_USER,
                'null': 'True',
                'blank': 'True'
            }),
            'name': ('django.db.models.fields.CharField', [], {
                'max_length': '80'
            }),
            'position': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            }),
            'post_count': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            }),
            'readed_by':
            ('django.db.models.fields.related.ManyToManyField', [], {
                'related_name': "'readed_forums'",
                'symmetrical': 'False',
                'through': "orm['pybb.ForumReadTracker']",
                'to': "orm['%s']" % AUTH_USER
            }),
            'topic_count': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            }),
            'updated': ('django.db.models.fields.DateTimeField', [], {
                'null': 'True',
                'blank': 'True'
            })
        },
        'pybb.forumreadtracker': {
            'Meta': {
                'object_name': 'ForumReadTracker'
            },
            'forum': ('django.db.models.fields.related.ForeignKey', [], {
                'to': "orm['pybb.Forum']",
                'null': 'True',
                'blank': 'True'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'time_stamp': ('django.db.models.fields.DateTimeField', [], {
                'auto_now': 'True',
                'blank': 'True'
            }),
            'user': ('django.db.models.fields.related.ForeignKey', [], {
                'to': "orm['%s']" % AUTH_USER
            })
        },
        'pybb.post': {
            'Meta': {
                'ordering': "['created']",
                'object_name': 'Post'
            },
            'body': ('django.db.models.fields.TextField', [], {}),
            'body_html': ('django.db.models.fields.TextField', [], {}),
            'body_text': ('django.db.models.fields.TextField', [], {}),
            'created': ('django.db.models.fields.DateTimeField', [], {
                'blank': 'True'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'markup': ('django.db.models.fields.CharField', [], {
                'default': "'bbcode'",
                'max_length': '15'
            }),
            'topic': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'posts'",
                'to': "orm['pybb.Topic']"
            }),
            'updated': ('django.db.models.fields.DateTimeField', [], {
                'null': 'True',
                'blank': 'True'
            }),
            'user': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'posts'",
                'to': "orm['%s']" % AUTH_USER
            }),
            'user_ip': ('django.db.models.fields.IPAddressField', [], {
                'default': "'0.0.0.0'",
                'max_length': '15',
                'blank': 'True'
            })
        },
        'pybb.profile': {
            'Meta': {
                'object_name': 'Profile'
            },
            'avatar': (get_image_field_full_name(), [], {
                'max_length': '100',
                'null': 'True',
                'blank': 'True'
            }),
            'ban_status': ('django.db.models.fields.SmallIntegerField', [], {
                'default': '0'
            }),
            'ban_till': ('django.db.models.fields.DateTimeField', [], {
                'default': 'None',
                'null': 'True',
                'blank': 'True'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'language': ('django.db.models.fields.CharField', [], {
                'max_length': '10',
                'blank': 'True'
            }),
            'markup': ('django.db.models.fields.CharField', [], {
                'default': "'bbcode'",
                'max_length': '15'
            }),
            'post_count': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            }),
            'show_signatures': ('django.db.models.fields.BooleanField', [], {
                'default': 'True'
            }),
            'signature': ('django.db.models.fields.TextField', [], {
                'max_length': '1024',
                'blank': 'True'
            }),
            'signature_html': ('django.db.models.fields.TextField', [], {
                'max_length': '1054',
                'blank': 'True'
            }),
            'time_zone': ('django.db.models.fields.FloatField', [], {
                'default': '3.0'
            }),
            'user': ('annoying.fields.AutoOneToOneField', [], {
                'related_name': "'pybb_profile'",
                'unique': 'True',
                'to': "orm['%s']" % AUTH_USER
            })
        },
        'pybb.topic': {
            'Meta': {
                'ordering': "['-created']",
                'object_name': 'Topic'
            },
            'closed': ('django.db.models.fields.BooleanField', [], {
                'default': 'False'
            }),
            'created': ('django.db.models.fields.DateTimeField', [], {
                'null': 'True'
            }),
            'forum': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'topics'",
                'to': "orm['pybb.Forum']"
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'name': ('django.db.models.fields.CharField', [], {
                'max_length': '255'
            }),
            'post_count': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            }),
            'readed_by':
            ('django.db.models.fields.related.ManyToManyField', [], {
                'related_name': "'readed_topics'",
                'symmetrical': 'False',
                'through': "orm['pybb.TopicReadTracker']",
                'to': "orm['%s']" % AUTH_USER
            }),
            'sticky': ('django.db.models.fields.BooleanField', [], {
                'default': 'False'
            }),
            'subscribers':
            ('django.db.models.fields.related.ManyToManyField', [], {
                'symmetrical': 'False',
                'related_name': "'subscriptions'",
                'blank': 'True',
                'to': "orm['%s']" % AUTH_USER
            }),
            'updated': ('django.db.models.fields.DateTimeField', [], {
                'null': 'True'
            }),
            'user': ('django.db.models.fields.related.ForeignKey', [], {
                'to': "orm['%s']" % AUTH_USER
            }),
            'views': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            })
        },
        'pybb.topicreadtracker': {
            'Meta': {
                'object_name': 'TopicReadTracker'
            },
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'time_stamp': ('django.db.models.fields.DateTimeField', [], {
                'auto_now': 'True',
                'blank': 'True'
            }),
            'topic': ('django.db.models.fields.related.ForeignKey', [], {
                'to': "orm['pybb.Topic']",
                'null': 'True',
                'blank': 'True'
            }),
            'user': ('django.db.models.fields.related.ForeignKey', [], {
                'to': "orm['%s']" % AUTH_USER
            })
        }
    }
    models.update(get_user_frozen_models(AUTH_USER))

    complete_apps = ['pybb']
class Migration(SchemaMigration):
    def forwards(self, orm):

        # Deleting field 'Attachment.hash'
        db.delete_column('noticeapp_attachment', 'hash')

        # Deleting field 'Attachment.content_type'
        db.delete_column('noticeapp_attachment', 'content_type')

        # Deleting field 'Attachment.path'
        db.delete_column('noticeapp_attachment', 'path')

        # Deleting field 'Attachment.name'
        db.delete_column('noticeapp_attachment', 'name')

    def backwards(self, orm):

        # Adding field 'Attachment.hash'
        db.add_column(
            'noticeapp_attachment',
            'hash',
            self.gf('django.db.models.fields.CharField')(blank=True,
                                                         default='',
                                                         max_length=40,
                                                         db_index=True),
            keep_default=False)

        # User chose to not deal with backwards NULL issues for 'Attachment.content_type'
        raise RuntimeError(
            "Cannot reverse this migration. 'Attachment.content_type' and its values cannot be restored."
        )

        # User chose to not deal with backwards NULL issues for 'Attachment.path'
        raise RuntimeError(
            "Cannot reverse this migration. 'Attachment.path' and its values cannot be restored."
        )

        # User chose to not deal with backwards NULL issues for 'Attachment.name'
        raise RuntimeError(
            "Cannot reverse this migration. 'Attachment.name' and its values cannot be restored."
        )

    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'
            })
        },
        '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'
            })
        },
        'noticeapp.attachment': {
            'Meta': {
                'object_name': 'Attachment'
            },
            'file': ('django.db.models.fields.files.FileField', [], {
                'max_length': '100'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'post': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'attachments'",
                'to': "orm['noticeapp.Post']"
            }),
            'size': ('django.db.models.fields.IntegerField', [], {})
        },
        'noticeapp.category': {
            'Meta': {
                'ordering': "['position']",
                'object_name': 'Category'
            },
            'hidden': ('django.db.models.fields.BooleanField', [], {
                'default': 'False'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'name': ('django.db.models.fields.CharField', [], {
                'max_length': '80'
            }),
            'position': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            })
        },
        'noticeapp.notice': {
            'Meta': {
                'ordering': "['position']",
                'object_name': 'Notice'
            },
            'category': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'notices'",
                'to': "orm['noticeapp.Category']"
            }),
            'description': ('django.db.models.fields.TextField', [], {
                'blank': 'True'
            }),
            'headline': ('django.db.models.fields.TextField', [], {
                'null': 'True',
                'blank': 'True'
            }),
            'hidden': ('django.db.models.fields.BooleanField', [], {
                'default': 'False'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'moderators':
            ('django.db.models.fields.related.ManyToManyField', [], {
                'symmetrical': 'False',
                'to': "orm['%s']" % AUTH_USER,
                'null': 'True',
                'blank': 'True'
            }),
            'name': ('django.db.models.fields.CharField', [], {
                'max_length': '80'
            }),
            'position': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            }),
            'post_count': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            }),
            'readed_by':
            ('django.db.models.fields.related.ManyToManyField', [], {
                'related_name': "'readed_notices'",
                'symmetrical': 'False',
                'through': "orm['noticeapp.NoticeReadTracker']",
                'to': "orm['%s']" % AUTH_USER
            }),
            'course_count': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            }),
            'updated': ('django.db.models.fields.DateTimeField', [], {
                'null': 'True',
                'blank': 'True'
            })
        },
        'noticeapp.noticereadtracker': {
            'Meta': {
                'object_name': 'NoticeReadTracker'
            },
            'notice': ('django.db.models.fields.related.ForeignKey', [], {
                'to': "orm['noticeapp.Notice']",
                'null': 'True',
                'blank': 'True'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'time_stamp': ('django.db.models.fields.DateTimeField', [], {
                'auto_now': 'True',
                'blank': 'True'
            }),
            'user': ('django.db.models.fields.related.ForeignKey', [], {
                'to': "orm['%s']" % AUTH_USER
            })
        },
        'noticeapp.post': {
            'Meta': {
                'ordering': "['created']",
                'object_name': 'Post'
            },
            'body': ('django.db.models.fields.TextField', [], {}),
            'body_html': ('django.db.models.fields.TextField', [], {}),
            'body_text': ('django.db.models.fields.TextField', [], {}),
            'created': ('django.db.models.fields.DateTimeField', [], {
                'blank': 'True'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'on_moderation': ('django.db.models.fields.BooleanField', [], {
                'default': 'False'
            }),
            'course': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'posts'",
                'to': "orm['noticeapp.Course']"
            }),
            'updated': ('django.db.models.fields.DateTimeField', [], {
                'null': 'True',
                'blank': 'True'
            }),
            'user': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'posts'",
                'to': "orm['%s']" % AUTH_USER
            }),
            'user_ip': ('django.db.models.fields.IPAddressField', [], {
                'default': "'0.0.0.0'",
                'max_length': '15',
                'blank': 'True'
            })
        },
        'noticeapp.profile': {
            'Meta': {
                'object_name': 'Profile'
            },
            'autosubscribe': ('django.db.models.fields.BooleanField', [], {
                'default': 'True'
            }),
            'avatar': (get_image_field_full_name(), [], {
                'max_length': '100',
                'null': 'True',
                'blank': 'True'
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'language': ('django.db.models.fields.CharField', [], {
                'default': "'English'",
                'max_length': '10',
                'blank': 'True'
            }),
            'post_count': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            }),
            'show_signatures': ('django.db.models.fields.BooleanField', [], {
                'default': 'True'
            }),
            'signature': ('django.db.models.fields.TextField', [], {
                'max_length': '1024',
                'blank': 'True'
            }),
            'signature_html': ('django.db.models.fields.TextField', [], {
                'max_length': '1054',
                'blank': 'True'
            }),
            'time_zone': ('django.db.models.fields.FloatField', [], {
                'default': '3.0'
            }),
            'user': ('annoying.fields.AutoOneToOneField', [], {
                'related_name': "'noticeapp_profile'",
                'unique': 'True',
                'to': "orm['%s']" % AUTH_USER
            })
        },
        'noticeapp.course': {
            'Meta': {
                'ordering': "['-created']",
                'object_name': 'Course'
            },
            'closed': ('django.db.models.fields.BooleanField', [], {
                'default': 'False'
            }),
            'created': ('django.db.models.fields.DateTimeField', [], {
                'null': 'True'
            }),
            'notice': ('django.db.models.fields.related.ForeignKey', [], {
                'related_name': "'courses'",
                'to': "orm['noticeapp.Notice']"
            }),
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'name': ('django.db.models.fields.CharField', [], {
                'max_length': '255'
            }),
            'on_moderation': ('django.db.models.fields.BooleanField', [], {
                'default': 'False'
            }),
            'post_count': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            }),
            'readed_by':
            ('django.db.models.fields.related.ManyToManyField', [], {
                'related_name': "'readed_courses'",
                'symmetrical': 'False',
                'through': "orm['noticeapp.CourseReadTracker']",
                'to': "orm['%s']" % AUTH_USER
            }),
            'sticky': ('django.db.models.fields.BooleanField', [], {
                'default': 'False'
            }),
            'subscribers':
            ('django.db.models.fields.related.ManyToManyField', [], {
                'symmetrical': 'False',
                'related_name': "'subscriptions'",
                'blank': 'True',
                'to': "orm['%s']" % AUTH_USER
            }),
            'updated': ('django.db.models.fields.DateTimeField', [], {
                'null': 'True'
            }),
            'user': ('django.db.models.fields.related.ForeignKey', [], {
                'to': "orm['%s']" % AUTH_USER
            }),
            'views': ('django.db.models.fields.IntegerField', [], {
                'default': '0',
                'blank': 'True'
            })
        },
        'noticeapp.coursereadtracker': {
            'Meta': {
                'object_name': 'CourseReadTracker'
            },
            'id': ('django.db.models.fields.AutoField', [], {
                'primary_key': 'True'
            }),
            'time_stamp': ('django.db.models.fields.DateTimeField', [], {
                'auto_now': 'True',
                'blank': 'True'
            }),
            'course': ('django.db.models.fields.related.ForeignKey', [], {
                'to': "orm['noticeapp.Course']",
                'null': 'True',
                'blank': 'True'
            }),
            'user': ('django.db.models.fields.related.ForeignKey', [], {
                'to': "orm['%s']" % AUTH_USER
            })
        }
    }
    models.update(get_user_frozen_models(AUTH_USER))

    complete_apps = ['noticeapp']