Move field to to th correct model

This commit is contained in:
2012-07-10 21:57:08 +01:00
parent bcd54c06d6
commit 1588882052
3 changed files with 128 additions and 2 deletions

View File

@@ -16,7 +16,7 @@ class CorporationAdmin(admin.ModelAdmin):
class KeyAdmin(admin.ModelAdmin):
list_display = ('keyid', 'corporation', 'mask', 'active', 'created', 'update')
list_filter = ('corporation', 'active')
readonly_fields = ('keyid', 'vcode', 'mask', 'corporation')
readonly_fields = ('keyid', 'vcode', 'mask', 'corporation', 'error')
class TransactionAdmin(admin.ModelAdmin):

View File

@@ -0,0 +1,126 @@
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Key.error'
db.add_column('core_key', 'error',
self.gf('django.db.models.fields.CharField')(max_length=512, null=True),
keep_default=False)
# Deleting field 'APICache.error'
db.delete_column('core_apicache', 'error')
def backwards(self, orm):
# Deleting field 'Key.error'
db.delete_column('core_key', 'error')
# Adding field 'APICache.error'
db.add_column('core_apicache', 'error',
self.gf('django.db.models.fields.CharField')(max_length=512, null=True),
keep_default=False)
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'})
},
'core.apicache': {
'Meta': {'object_name': 'APICache'},
'cache_until': ('django.db.models.fields.DateTimeField', [], {}),
'document': ('django.db.models.fields.TextField', [], {}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'key': ('django.db.models.fields.CharField', [], {'max_length': '40'})
},
'core.character': {
'Meta': {'object_name': 'Character'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '255'})
},
'core.corporation': {
'Meta': {'object_name': 'Corporation'},
'balance': ('django.db.models.fields.DecimalField', [], {'default': '0', 'max_digits': '25', 'decimal_places': '2'}),
'ceo': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['core.Character']"}),
'contact': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'corporations'", 'null': 'True', 'to': "orm['auth.User']"}),
'fixed_value': ('django.db.models.fields.DecimalField', [], {'default': 'None', 'null': 'True', 'max_digits': '25', 'decimal_places': '2', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'last_transaction': ('django.db.models.fields.BigIntegerField', [], {'default': '0'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'payment_id': ('django.db.models.fields.CharField', [], {'max_length': '36'}),
'tax_rate': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'})
},
'core.key': {
'Meta': {'object_name': 'Key'},
'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'corporation': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'keys'", 'to': "orm['core.Corporation']"}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'error': ('django.db.models.fields.CharField', [], {'max_length': '512', 'null': 'True'}),
'keyid': ('django.db.models.fields.BigIntegerField', [], {'primary_key': 'True'}),
'mask': ('django.db.models.fields.BigIntegerField', [], {}),
'update': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'vcode': ('django.db.models.fields.CharField', [], {'max_length': '64'})
},
'core.monthtotal': {
'Meta': {'ordering': "['-year', '-month']", 'object_name': 'MonthTotal'},
'charged': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'corporation': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'totals'", 'to': "orm['core.Corporation']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'month': ('django.db.models.fields.PositiveIntegerField', [], {}),
'tax': ('django.db.models.fields.DecimalField', [], {'default': '0', 'max_digits': '25', 'decimal_places': '2'}),
'year': ('django.db.models.fields.PositiveIntegerField', [], {})
},
'core.setting': {
'Meta': {'object_name': 'Setting'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'key': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
'value': ('django.db.models.fields.CharField', [], {'max_length': '200'})
},
'core.transaction': {
'Meta': {'ordering': "['-date']", 'object_name': 'Transaction'},
'comment': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'corporation': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'transactions'", 'to': "orm['core.Corporation']"}),
'date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'type': ('django.db.models.fields.PositiveIntegerField', [], {}),
'value': ('django.db.models.fields.DecimalField', [], {'max_digits': '25', 'decimal_places': '2'})
}
}
complete_apps = ['core']

View File

@@ -113,6 +113,7 @@ class Key(models.Model):
created = models.DateTimeField('Created Date/Time', auto_now_add=True)
update = models.DateTimeField('Last Update Date/Time', auto_now=True)
error = models.CharField('API Error', blank=False, null=True, max_length=512)
@staticmethod
def check_access_bit(accessmask, bit):
@@ -156,7 +157,6 @@ class APICache(models.Model):
key = models.CharField('Cache Key', blank=False, max_length=40)
cache_until = models.DateTimeField('Cached Until', blank=False)
document = models.TextField('Document')
error = models.CharField('API Error', blank=False, null=True, max_length=512)
class DjangoCacheHandler(object):