Skip to content

Commit 3f85b5d

Browse files
committed
Various misc model fixes
1 parent 6d0684b commit 3f85b5d

21 files changed

Lines changed: 145 additions & 96 deletions

thing/models/__init__.py

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,53 @@
11
# Locations
2-
from .constellation import Constellation
3-
from .region import Region
4-
from .system import System
5-
from .station import Station
2+
from thing.models.region import Region
3+
from thing.models.constellation import Constellation
4+
from thing.models.system import System
5+
from thing.models.station import Station
66

77
# Entities
8-
from .faction import Faction
9-
from .alliance import Alliance
10-
from .corporation import Corporation
11-
from .character import Character
8+
from thing.models.faction import Faction
9+
from thing.models.alliance import Alliance
10+
from thing.models.corporation import Corporation
11+
from thing.models.character import Character
1212

1313
#
14-
from .inventoryflag import InventoryFlag
15-
from .reftype import RefType
14+
from thing.models.inventoryflag import InventoryFlag
15+
from thing.models.reftype import RefType
1616

1717
# Items
18-
from .marketgroup import MarketGroup
19-
from .itemcategory import ItemCategory
20-
from .itemgroup import ItemGroup
21-
from .item import Item
22-
from .blueprint import Blueprint
23-
from .skill import Skill
18+
from thing.models.marketgroup import MarketGroup
19+
from thing.models.itemcategory import ItemCategory
20+
from thing.models.itemgroup import ItemGroup
21+
from thing.models.item import Item
22+
from thing.models.blueprint import Blueprint
23+
from thing.models.skill import Skill
2424

2525
# Everything else
26-
from .apikey import APIKey
27-
from .apikeyfailure import APIKeyFailure
28-
from .asset import Asset
29-
from .assetsummary import AssetSummary
30-
from .blueprintcomponent import BlueprintComponent
31-
from .blueprintinstance import BlueprintInstance
32-
from .campaign import Campaign
33-
from .characterconfig import CharacterConfig
34-
from .characterdetails import CharacterDetails
35-
from .characterskill import CharacterSkill
36-
from .contract import Contract
37-
from .contractitem import ContractItem
38-
from .corporationstanding import CorporationStanding
39-
from .corpwallet import CorpWallet
40-
from .event import Event
41-
from .factionstanding import FactionStanding
42-
from .industryjob import IndustryJob
43-
from .journalentry import JournalEntry
44-
from .marketorder import MarketOrder
45-
from .pricehistory import PriceHistory
46-
from .skillplan import SkillPlan
47-
from .skillqueue import SkillQueue
48-
from .spentry import SPEntry
49-
from .spremap import SPRemap
50-
from .spskill import SPSkill
51-
from .taskstate import TaskState
52-
from .transaction import Transaction
53-
from .userprofile import UserProfile
26+
from thing.models.apikey import APIKey
27+
from thing.models.apikeyfailure import APIKeyFailure
28+
from thing.models.asset import Asset
29+
from thing.models.assetsummary import AssetSummary
30+
from thing.models.blueprintcomponent import BlueprintComponent
31+
from thing.models.blueprintinstance import BlueprintInstance
32+
from thing.models.campaign import Campaign
33+
from thing.models.characterconfig import CharacterConfig
34+
from thing.models.characterdetails import CharacterDetails
35+
from thing.models.characterskill import CharacterSkill
36+
from thing.models.contract import Contract
37+
from thing.models.contractitem import ContractItem
38+
from thing.models.corporationstanding import CorporationStanding
39+
from thing.models.corpwallet import CorpWallet
40+
from thing.models.event import Event
41+
from thing.models.factionstanding import FactionStanding
42+
from thing.models.industryjob import IndustryJob
43+
from thing.models.journalentry import JournalEntry
44+
from thing.models.marketorder import MarketOrder
45+
from thing.models.pricehistory import PriceHistory
46+
from thing.models.skillplan import SkillPlan
47+
from thing.models.skillqueue import SkillQueue
48+
from thing.models.spentry import SPEntry
49+
from thing.models.spremap import SPRemap
50+
from thing.models.spskill import SPSkill
51+
from thing.models.taskstate import TaskState
52+
from thing.models.transaction import Transaction
53+
from thing.models.userprofile import UserProfile

thing/models/apikey.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232

3333
from core.util import total_seconds
3434

35+
from thing.models.character import Character
36+
3537
# ------------------------------------------------------------------------------
3638
# API keys
3739
class APIKey(models.Model):
@@ -105,10 +107,14 @@ class APIKey(models.Model):
105107
created_at = models.DateTimeField(auto_now=True)
106108
valid = models.BooleanField(default=True)
107109

108-
characters = models.ManyToManyField('Character', related_name='apikeys')
110+
characters = models.ManyToManyField(Character, related_name='apikeys')
109111

110112
# this is only used for corporate keys, ugh
111-
corp_character = models.ForeignKey('Character', null=True, blank=True, related_name='corporate_apikey')
113+
corp_character = models.ForeignKey(Character, null=True, blank=True, related_name='corporate_apikey')
114+
115+
class Meta:
116+
app_label = 'thing'
117+
ordering = ('keyid',)
112118

113119
def __unicode__(self):
114120
return '#%s, keyId: %s (%s)' % (self.id, self.keyid, self.key_type)
@@ -149,8 +155,4 @@ def purge_data(self):
149155

150156
send_task('thing.purge_api_key', args=[self.id], kwargs={}, queue='et_high')
151157

152-
class Meta:
153-
app_label = 'thing'
154-
ordering = ('keyid',)
155-
156158
# ------------------------------------------------------------------------------

thing/models/asset.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,26 @@
2626
from django.contrib.auth.models import User
2727
from django.db import models
2828

29+
from thing.models.character import Character
30+
from thing.models.inventoryflag import InventoryFlag
31+
from thing.models.item import Item
32+
from thing.models.station import Station
33+
from thing.models.system import System
34+
2935
# ------------------------------------------------------------------------------
3036
# Assets
3137
class Asset(models.Model):
3238
asset_id = models.BigIntegerField(db_index=True)
3339
parent = models.BigIntegerField(default=0)
3440

35-
character = models.ForeignKey('Character')
41+
character = models.ForeignKey(Character)
3642
corporation_id = models.IntegerField(default=0, db_index=True)
37-
system = models.ForeignKey('System')
38-
station = models.ForeignKey('Station', blank=True, null=True)
43+
system = models.ForeignKey(System)
44+
station = models.ForeignKey(Station, blank=True, null=True)
3945

40-
item = models.ForeignKey('Item')
46+
item = models.ForeignKey(Item)
4147
name = models.CharField(max_length=128, default='')
42-
inv_flag = models.ForeignKey('InventoryFlag')
48+
inv_flag = models.ForeignKey(InventoryFlag)
4349
quantity = models.IntegerField()
4450
raw_quantity = models.IntegerField()
4551
singleton = models.BooleanField()

thing/models/assetsummary.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,17 @@
2525

2626
from django.db import models
2727

28+
from thing.models.character import Character
29+
from thing.models.station import Station
30+
from thing.models.system import System
31+
2832
# ------------------------------------------------------------------------------
2933

3034
class AssetSummary(models.Model):
31-
character = models.ForeignKey('Character')
35+
character = models.ForeignKey(Character)
3236
corporation_id = models.IntegerField(default=0)
33-
system = models.ForeignKey('System')
34-
station = models.ForeignKey('Station', blank=True, null=True)
37+
system = models.ForeignKey(System)
38+
station = models.ForeignKey(Station, blank=True, null=True)
3539

3640
total_items = models.BigIntegerField()
3741
# 1,234,567,890.12

thing/models/blueprint.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,24 @@
2323
# OF SUCH DAMAGE.
2424
# ------------------------------------------------------------------------------
2525

26-
from django.contrib.auth.models import User
2726
from django.db import models
2827

28+
#from thing.models.blueprintcomponent import BlueprintComponent
29+
from thing.models.item import Item
30+
2931
# ------------------------------------------------------------------------------
3032
# Blueprints
3133
class Blueprint(models.Model):
3234
id = models.IntegerField(primary_key=True)
3335
name = models.CharField(max_length=128)
34-
item = models.ForeignKey('Item')
36+
item = models.ForeignKey(Item)
3537

3638
production_time = models.IntegerField()
3739
productivity_modifier = models.IntegerField()
3840
material_modifier = models.IntegerField()
3941
waste_factor = models.IntegerField()
4042

41-
components = models.ManyToManyField('Item', related_name='component_of', through='BlueprintComponent')
43+
#components = models.ManyToManyField(Item, related_name='component_of', through='BlueprintComponent')
4244

4345
class Meta:
4446
app_label = 'thing'

thing/models/blueprintcomponent.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,15 @@
2525

2626
from django.db import models
2727

28+
from thing.models.blueprint import Blueprint
29+
from thing.models.item import Item
30+
2831
# ------------------------------------------------------------------------------
2932
# Blueprint components
3033
class BlueprintComponent(models.Model):
31-
blueprint = models.ForeignKey('Blueprint')
34+
blueprint = models.ForeignKey(Blueprint)
3235

33-
item = models.ForeignKey('Item')
36+
item = models.ForeignKey(Item)
3437
count = models.IntegerField()
3538
needs_waste = models.BooleanField(default=True)
3639

thing/models/blueprintinstance.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@
2626
from django.contrib.auth.models import User
2727
from django.db import models
2828

29+
from thing.models.blueprint import Blueprint
30+
2931
# ------------------------------------------------------------------------------
3032
# Blueprint instances - an owned blueprint
3133
class BlueprintInstance(models.Model):
3234
user = models.ForeignKey(User, blank=True, null=True)
33-
blueprint = models.ForeignKey('Blueprint')
35+
blueprint = models.ForeignKey(Blueprint)
3436

3537
original = models.BooleanField()
3638
material_level = models.IntegerField(default=0)

thing/models/campaign.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
from django.contrib.auth.models import User
2727
from django.db import models
2828

29+
from thing.models.character import Character
30+
from thing.models.corpwallet import CorpWallet
31+
2932
# ------------------------------------------------------------------------------
3033

3134
class Campaign(models.Model):
@@ -36,8 +39,8 @@ class Campaign(models.Model):
3639
start_date = models.DateTimeField()
3740
end_date = models.DateTimeField()
3841

39-
corp_wallets = models.ManyToManyField('CorpWallet', blank=True, null=True)
40-
characters = models.ManyToManyField('Character', blank=True, null=True)
42+
corp_wallets = models.ManyToManyField(CorpWallet, blank=True, null=True)
43+
characters = models.ManyToManyField(Character, blank=True, null=True)
4144

4245
class Meta:
4346
app_label = 'thing'

thing/models/character.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,13 @@
2525

2626
from django.db import models
2727

28-
from .characterskill import CharacterSkill
29-
from .corporation import Corporation
30-
from .faction import Faction
31-
from .skill import Skill
28+
#from thing.models.characterskill import CharacterSkill
29+
from thing.models.corporation import Corporation
30+
from thing.models.corporationstanding import CorporationStanding
31+
from thing.models.faction import Faction
32+
from thing.models.factionstanding import FactionStanding
33+
from thing.models.skill import Skill
34+
#from thing.models.skillqueue import SkillQueue
3235

3336
# ------------------------------------------------------------------------------
3437

@@ -39,12 +42,12 @@ class Character(models.Model):
3942
corporation = models.ForeignKey(Corporation, blank=True, null=True)
4043

4144
# Skill stuff
42-
skills = models.ManyToManyField(Skill, related_name='learned_by', through='CharacterSkill')
43-
skill_queue = models.ManyToManyField(Skill, related_name='training_by', through='SkillQueue')
45+
#skills = models.ManyToManyField(Skill, related_name='learned_by', through='CharacterSkill')
46+
#skill_queue = models.ManyToManyField(Skill, related_name='training_by', through='SkillQueue')
4447

4548
# Standings stuff
46-
faction_standings = models.ManyToManyField(Faction, related_name='has_standings', through='FactionStanding')
47-
corporation_standings = models.ManyToManyField(Corporation, related_name='has_standings', through='CorporationStanding')
49+
#faction_standings = models.ManyToManyField(Faction, related_name='has_standings', through='FactionStanding')
50+
#corporation_standings = models.ManyToManyField(Corporation, related_name='has_standings', through='CorporationStanding')
4851

4952
class Meta:
5053
app_label = 'thing'

thing/models/characterconfig.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@
2525

2626
from django.db import models
2727

28+
from thing.models.character import Character
29+
2830
# ------------------------------------------------------------------------------
2931
# Character configuration information
3032
class CharacterConfig(models.Model):
31-
character = models.OneToOneField('Character', unique=True, primary_key=True, related_name='config')
33+
character = models.OneToOneField(Character, unique=True, primary_key=True, related_name='config')
3234

3335
is_public = models.BooleanField(default=False)
3436
show_clone = models.BooleanField(default=False)

0 commit comments

Comments
 (0)