From 842de652103a31ecceb1c0519502798b7a33e35f Mon Sep 17 00:00:00 2001 From: Tom Crossley FEARNLEY Date: Thu, 16 Apr 2020 20:12:02 +0100 Subject: [PATCH] Capitalised Class Names Now --- app/admin.py | 60 ++--- app/migrations/0003_auto_20200416_1911.py | 300 ++++++++++++++++++++++ app/models.py | 132 +++++----- app/views.py | 2 +- 4 files changed, 397 insertions(+), 97 deletions(-) create mode 100644 app/migrations/0003_auto_20200416_1911.py diff --git a/app/admin.py b/app/admin.py index 3a0901a..94b6460 100644 --- a/app/admin.py +++ b/app/admin.py @@ -1,41 +1,41 @@ from django.contrib import admin from .models import * -admin.site.register(rollConfiguration) +admin.site.register(RollConfiguration) -admin.site.register(modifierAttribute) -admin.site.register(modifierAbility) -admin.site.register(modifierStatic) +admin.site.register(ModifierAttribute) +admin.site.register(ModifierAbility) +admin.site.register(ModifierStatic) -admin.site.register(item) -admin.site.register(itemWeaponMelee) -admin.site.register(itemWeaponRanged) -admin.site.register(itemArmor) +admin.site.register(Item) +admin.site.register(ItemWeaponMelee) +admin.site.register(ItemWeaponRanged) +admin.site.register(ItemArmor) -admin.site.register(charmSolar) -admin.site.register(charmLunar) -admin.site.register(charmLunarShape) -admin.site.register(charmEvocation) -admin.site.register(charmMartialArt) +admin.site.register(CharmSolar) +admin.site.register(CharmLunar) +admin.site.register(CharmLunarShape) +admin.site.register(CharmEvocation) +admin.site.register(CharmMartialArt) -admin.site.register(merit) +admin.site.register(Merit) -admin.site.register(speciality) +admin.site.register(Speciality) -admin.site.register(intimacyTie) -admin.site.register(intimacyPrincipal) +admin.site.register(IntimacyTie) +admin.site.register(IntimacyPrincipal) -admin.site.register(characterMortal) -admin.site.register(characterExaltSolar) -admin.site.register(characterExaltLunar) +admin.site.register(CharacterMortal) +admin.site.register(CharacterExaltSolar) +admin.site.register(CharacterExaltLunar) -admin.site.register(ownershipItem) -admin.site.register(ownershipItemWeapon) -admin.site.register(ownershipItemArmor) -admin.site.register(ownershipCharmMartialArt) -admin.site.register(ownershipCharmEvocation) -admin.site.register(ownershipCharmSolar) -admin.site.register(ownershipCharmLunar) -admin.site.register(ownershipCharmLunarShape) -admin.site.register(ownershipMerit) -admin.site.register(ownershipSpeciality) +admin.site.register(OwnershipItem) +admin.site.register(OwnershipItemWeapon) +admin.site.register(OwnershipItemArmor) +admin.site.register(OwnershipCharmMartialArt) +admin.site.register(OwnershipCharmEvocation) +admin.site.register(OwnershipCharmSolar) +admin.site.register(OwnershipCharmLunar) +admin.site.register(OwnershipCharmLunarShape) +admin.site.register(OwnershipMerit) +admin.site.register(OwnershipSpeciality) diff --git a/app/migrations/0003_auto_20200416_1911.py b/app/migrations/0003_auto_20200416_1911.py new file mode 100644 index 0000000..06b9570 --- /dev/null +++ b/app/migrations/0003_auto_20200416_1911.py @@ -0,0 +1,300 @@ +# Generated by Django 3.0.5 on 2020-04-16 19:11 + +import app.models +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('app', '0002_auto_20200415_2109'), + ] + + operations = [ + migrations.AlterField( + model_name='characterexaltbase', + name='characterbase_ptr', + field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='app.CharacterBase'), + ), + migrations.AlterField( + model_name='characterexaltlunar', + name='characterexaltbase_ptr', + field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='app.CharacterExaltBase'), + ), + migrations.AlterField( + model_name='characterexaltsolar', + name='characterexaltbase_ptr', + field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='app.CharacterExaltBase'), + ), + migrations.AlterField( + model_name='charactermortal', + name='characterbase_ptr', + field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='app.CharacterBase'), + ), + migrations.AlterField( + model_name='charmbase', + name='effectbase_ptr', + field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='app.EffectBase'), + ), + migrations.AlterField( + model_name='charmevocation', + name='charmbase_ptr', + field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='app.CharmBase'), + ), + migrations.AlterField( + model_name='charmevocation', + name='key', + field=app.models.NamedForeignKeyField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='app.ItemBase', verbose_name='Artifact'), + ), + migrations.AlterField( + model_name='charmlunar', + name='charmbase_ptr', + field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='app.CharmBase'), + ), + migrations.AlterField( + model_name='charmlunarshape', + name='charmbase_ptr', + field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='app.CharmBase'), + ), + migrations.AlterField( + model_name='charmmartialart', + name='charmbase_ptr', + field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='app.CharmBase'), + ), + migrations.AlterField( + model_name='charmsolar', + name='charmbase_ptr', + field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='app.CharmBase'), + ), + migrations.AlterField( + model_name='effectbase', + name='modifiers', + field=app.models.NamedManyToManyField(blank=True, to='app.ModifierBase', verbose_name='Modifiers'), + ), + migrations.AlterField( + model_name='effectbase', + name='rollConfiguration', + field=app.models.NamedManyToManyField(blank=True, to='app.RollConfiguration', verbose_name='Roll Configurations'), + ), + migrations.AlterField( + model_name='intimacybase', + name='character', + field=app.models.NamedForeignKeyField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='intimacy_set', to='app.CharacterBase', verbose_name='Character'), + ), + migrations.AlterField( + model_name='intimacyprincipal', + name='intimacybase_ptr', + field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='app.IntimacyBase'), + ), + migrations.AlterField( + model_name='intimacytie', + name='intimacybase_ptr', + field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='app.IntimacyBase'), + ), + migrations.AlterField( + model_name='item', + name='itembase_ptr', + field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='app.ItemBase'), + ), + migrations.AlterField( + model_name='itemarmor', + name='itembase_ptr', + field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='app.ItemBase'), + ), + migrations.AlterField( + model_name='itemweaponbase', + name='itembase_ptr', + field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='app.ItemBase'), + ), + migrations.AlterField( + model_name='itemweaponbase', + name='tags', + field=app.models.MultiChoiceField(blank=True, choices=[('General', (('One Handed', 'One Handed'), ('Two Handed', 'Two Handed'), ('Bashing', 'Bashing'), ('Concealable', 'Concealable'), ('Lethal', 'Lethal'), ('Mounted', 'Mounted'), ('Piercing', 'Piercing'), ('Special', 'Special'))), ('Melee', (('Melee', 'Melee'), ('Balanced', 'Balanced'), ('Brawl', 'Brawl'), ('Chopping', 'Chopping'), ('Disarming', 'Disarming'), ('Flexible', 'Flexible'), ('Improvised', 'Improvised'), ('Grappling', 'Grappling'), ('Martial Arts', 'Martial Arts'), ('Natural', 'Natural'), ('Reaching', 'Reaching'), ('Shield', 'Shield'), ('Smashing', 'Smashing'), ('Worn', 'Worn'))), ('Thrown', (('Thrown', 'Thrown'), ('Occult', 'Occult'), ('Cutting', 'Cutting'), ('Poisonable', 'Poisonable'), ('Subtle', 'Subtle'))), ('Archery', (('Archery', 'Archery'), ('Crossbow', 'Crossbow'), ('Flame', 'Flame'), ('Powerful', 'Powerful'), ('Slow', 'Slow')))], max_length=100, verbose_name='Tags'), + ), + migrations.AlterField( + model_name='itemweaponmelee', + name='itemweaponbase_ptr', + field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='app.ItemWeaponBase'), + ), + migrations.AlterField( + model_name='itemweaponranged', + name='itemweaponbase_ptr', + field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='app.ItemWeaponBase'), + ), + migrations.AlterField( + model_name='merit', + name='effectbase_ptr', + field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='app.EffectBase'), + ), + migrations.AlterField( + model_name='modifierability', + name='modifierbase_ptr', + field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='app.ModifierBase'), + ), + migrations.AlterField( + model_name='modifierattribute', + name='modifierbase_ptr', + field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='app.ModifierBase'), + ), + migrations.AlterField( + model_name='modifierstatic', + name='modifierbase_ptr', + field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='app.ModifierBase'), + ), + migrations.AlterField( + model_name='ownershipcharmevocation', + name='owner', + field=app.models.NamedForeignKeyField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='ownershipCharmEvocation_set', to='app.CharacterExaltBase', verbose_name='Exalted Owner'), + ), + migrations.AlterField( + model_name='ownershipcharmevocation', + name='ownershipbase_ptr', + field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='app.OwnershipBase'), + ), + migrations.AlterField( + model_name='ownershipcharmevocation', + name='target', + field=app.models.NamedForeignKeyField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='ownershipCharmEvocationTarget_set', to='app.CharmEvocation', verbose_name='Evocation'), + ), + migrations.AlterField( + model_name='ownershipcharmlunar', + name='owner', + field=app.models.NamedForeignKeyField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='ownershipCharmLunar_set', to='app.CharacterExaltLunar', verbose_name='Lunar Exalted Owner'), + ), + migrations.AlterField( + model_name='ownershipcharmlunar', + name='ownershipbase_ptr', + field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='app.OwnershipBase'), + ), + migrations.AlterField( + model_name='ownershipcharmlunar', + name='target', + field=app.models.NamedForeignKeyField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='ownershipCharmLunarTarget_set', to='app.CharmLunar', verbose_name='Lunar Charm'), + ), + migrations.AlterField( + model_name='ownershipcharmlunarshape', + name='owner', + field=app.models.NamedForeignKeyField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='ownershipCharmLunarShape_set', to='app.CharacterExaltLunar', verbose_name='Lunar Exalted Owner'), + ), + migrations.AlterField( + model_name='ownershipcharmlunarshape', + name='ownershipbase_ptr', + field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='app.OwnershipBase'), + ), + migrations.AlterField( + model_name='ownershipcharmlunarshape', + name='target', + field=app.models.NamedForeignKeyField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='ownershipCharmLunarShapeTarget_set', to='app.CharmLunarShape', verbose_name='Lunar Shape'), + ), + migrations.AlterField( + model_name='ownershipcharmmartialart', + name='owner', + field=app.models.NamedForeignKeyField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='ownershipCharmMartialArt_set', to='app.CharacterExaltBase', verbose_name='Exalted Owner'), + ), + migrations.AlterField( + model_name='ownershipcharmmartialart', + name='ownershipbase_ptr', + field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='app.OwnershipBase'), + ), + migrations.AlterField( + model_name='ownershipcharmmartialart', + name='target', + field=app.models.NamedForeignKeyField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='ownershipCharmMartialArtTarget_set', to='app.CharmMartialArt', verbose_name='Martial Arts Charm'), + ), + migrations.AlterField( + model_name='ownershipcharmsolar', + name='owner', + field=app.models.NamedForeignKeyField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='ownershipCharmSolar_set', to='app.CharacterExaltSolar', verbose_name='Solar Exalted Owner'), + ), + migrations.AlterField( + model_name='ownershipcharmsolar', + name='ownershipbase_ptr', + field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='app.OwnershipBase'), + ), + migrations.AlterField( + model_name='ownershipcharmsolar', + name='target', + field=app.models.NamedForeignKeyField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='ownershipCharmSolarTarget_set', to='app.CharmSolar', verbose_name='Solar Charm'), + ), + migrations.AlterField( + model_name='ownershipitem', + name='owner', + field=app.models.NamedForeignKeyField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='ownershipItem_set', to='app.CharacterBase', verbose_name='Owner'), + ), + migrations.AlterField( + model_name='ownershipitem', + name='ownershipbase_ptr', + field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='app.OwnershipBase'), + ), + migrations.AlterField( + model_name='ownershipitem', + name='target', + field=app.models.NamedForeignKeyField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='ownershipItemTarget_set', to='app.Item', verbose_name='Item'), + ), + migrations.AlterField( + model_name='ownershipitemarmor', + name='owner', + field=app.models.NamedForeignKeyField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='ownershipItemArmor_set', to='app.CharacterBase', verbose_name='Owner'), + ), + migrations.AlterField( + model_name='ownershipitemarmor', + name='ownershipbase_ptr', + field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='app.OwnershipBase'), + ), + migrations.AlterField( + model_name='ownershipitemarmor', + name='target', + field=app.models.NamedForeignKeyField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='ownershipItemArmorTarget_set', to='app.ItemArmor', verbose_name='Armor'), + ), + migrations.AlterField( + model_name='ownershipitemweapon', + name='owner', + field=app.models.NamedForeignKeyField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='ownershipItemWeapon_set', to='app.CharacterBase', verbose_name='Owner'), + ), + migrations.AlterField( + model_name='ownershipitemweapon', + name='ownershipbase_ptr', + field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='app.OwnershipBase'), + ), + migrations.AlterField( + model_name='ownershipitemweapon', + name='target', + field=app.models.NamedForeignKeyField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='ownershipItemWeaponTarget_set', to='app.ItemWeaponBase', verbose_name='Weapon'), + ), + migrations.AlterField( + model_name='ownershipmerit', + name='owner', + field=app.models.NamedForeignKeyField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='ownershipMerit_set', to='app.CharacterBase', verbose_name='Owner'), + ), + migrations.AlterField( + model_name='ownershipmerit', + name='ownershipbase_ptr', + field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='app.OwnershipBase'), + ), + migrations.AlterField( + model_name='ownershipmerit', + name='target', + field=app.models.NamedForeignKeyField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='ownershipMeritTarget_set', to='app.Merit', verbose_name='Merit'), + ), + migrations.AlterField( + model_name='ownershipspeciality', + name='owner', + field=app.models.NamedForeignKeyField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='ownershipSpeciality_set', to='app.CharacterBase', verbose_name='Owner'), + ), + migrations.AlterField( + model_name='ownershipspeciality', + name='ownershipbase_ptr', + field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='app.OwnershipBase'), + ), + migrations.AlterField( + model_name='ownershipspeciality', + name='target', + field=app.models.NamedForeignKeyField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='ownershipSpecialityTarget_set', to='app.Speciality', verbose_name='Speciality'), + ), + migrations.AlterField( + model_name='speciality', + name='effectbase_ptr', + field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='app.EffectBase'), + ), + ] diff --git a/app/models.py b/app/models.py index 3b23673..d9f21bd 100644 --- a/app/models.py +++ b/app/models.py @@ -330,7 +330,7 @@ class NamedOneToOneField(models.OneToOneField): #==============================================================================# #-------------------------------- DICE ROLLING --------------------------------# #==============================================================================# -class rollConfiguration(PolymorphicModel): +class RollConfiguration(PolymorphicModel): def __str__(self): return self.name name = NameField() @@ -397,22 +397,22 @@ class rollConfiguration(PolymorphicModel): #==============================================================================# #--------------------------------- MODIFIERS ----------------------------------# #==============================================================================# -class modifierBase(PolymorphicModel): +class ModifierBase(PolymorphicModel): value = NamedIntegerField("Modifier Value") -class modifierAttribute(modifierBase): +class ModifierAttribute(ModifierBase): def __str__(self): return "{} [{}]".format(self.keyword, self.value) keyword = SingleChoiceField("Attribute", ATTRIBUTES) -class modifierAbility(modifierBase): +class ModifierAbility(ModifierBase): def __str__(self): return "{} [{}]".format(self.keyword, self.value) keyword = SingleChoiceField("Ability", ABILITIES) -class modifierStatic(modifierBase): +class ModifierStatic(ModifierBase): def __str__(self): return "{} [{}]".format(self.keyword, self.value) @@ -421,7 +421,7 @@ class modifierStatic(modifierBase): #==============================================================================# #--------------------------------- CHARACTERS ---------------------------------# #==============================================================================# -class characterBase(PolymorphicModel): +class CharacterBase(PolymorphicModel): def __str__(self): return self.name @@ -970,7 +970,11 @@ class characterBase(PolymorphicModel): def disengage(self, mod=0): return mod + self.attributeDexterity() + self.abilityDodge() + self.effectModifier("DISENGAGE") -class characterExaltBase(characterBase): +class CharacterMortal(CharacterBase): + def type(self): + return "Mortal" + +class CharacterExaltBase(CharacterBase): anima = models.CharField(verbose_name="Anima", max_length=100) #============= MOTES ==============# @@ -1017,11 +1021,7 @@ class characterExaltBase(characterBase): pass return output -class characterMortal(characterBase): - def type(self): - return "Mortal" - -class characterExaltSolar(characterExaltBase): +class CharacterExaltSolar(CharacterExaltBase): def type(self): return "Solar Exalt" @@ -1042,7 +1042,7 @@ class characterExaltSolar(characterExaltBase): abilitySupernal = SingleChoiceField("Supernal Ability", ABILITIES) abilityFavored = MultiChoiceField("Favoured Abilities", ABILITIES) -class characterExaltLunar(characterExaltBase): +class CharacterExaltLunar(CharacterExaltBase): def type(self): return "Lunar Exalt" @@ -1078,20 +1078,20 @@ class characterExaltLunar(characterExaltBase): #==============================================================================# #----------------------------------- ITEMS ------------------------------------# #==============================================================================# -class itemBase(PolymorphicModel): +class ItemBase(PolymorphicModel): def __str__(self): return self.name name = NameField() description = DescriptionField() -class item(itemBase): +class Item(ItemBase): pass #==============================================================================# #---------------------------------- WEAPONS -----------------------------------# #==============================================================================# -class itemWeaponBase(itemBase): +class ItemWeaponBase(ItemBase): category = SingleChoiceField("Category", CATEGORIES) tags = MultiChoiceField("Tags", TAGS_WEAPONS) accuracy = NamedIntegerField("Accuracy") @@ -1100,7 +1100,7 @@ class itemWeaponBase(itemBase): overwhelming = NamedIntegerField("Overwhelming") attunement = NamedIntegerField("Attunement") -class itemWeaponMelee(itemWeaponBase): +class ItemWeaponMelee(ItemWeaponBase): def attack(self, ability, mod=0, withering=True): if withering: return mod + ability + self.dexterity + weapon.accuracy @@ -1111,7 +1111,7 @@ class itemWeaponMelee(itemWeaponBase): mod += sum([]) return mod + ceil((self.dexterity + ability) / 2) + weapon.defense -class itemWeaponRanged(itemWeaponBase): +class ItemWeaponRanged(ItemWeaponBase): rangeClose = NamedIntegerField("Close Range") rangeShort = NamedIntegerField("Short Range") rangeMedium = NamedIntegerField("Medium Range") @@ -1139,7 +1139,7 @@ class itemWeaponRanged(itemWeaponBase): #==============================================================================# #----------------------------------- ARMOR ------------------------------------# #==============================================================================# -class itemArmor(itemBase): +class ItemArmor(ItemBase): category = SingleChoiceField("Category", CATEGORIES) tags = MultiChoiceField("Tags", TAGS_ARMOR) soak = NamedIntegerField("Soak") @@ -1151,14 +1151,14 @@ class itemArmor(itemBase): #---------------------------------- EFFECTS -----------------------------------# #==============================================================================# -class effectBase(PolymorphicModel): +class EffectBase(PolymorphicModel): def __str__(self): return self.name name = NameField() description = DescriptionField() - rollConfiguration = NamedManyToManyField("Roll Configurations", rollConfiguration) - modifiers = NamedManyToManyField("Modifiers", modifierBase) + rollConfiguration = NamedManyToManyField("Roll Configurations", RollConfiguration) + modifiers = NamedManyToManyField("Modifiers", ModifierBase) def modifier(self, keyword): output = 0 for modifier in self.modifiers.all(): @@ -1169,37 +1169,37 @@ class effectBase(PolymorphicModel): #==============================================================================# #----------------------------------- CHARMS -----------------------------------# #==============================================================================# -class charmBase(effectBase): +class CharmBase(EffectBase): levelEssence = NamedIntegerField("Essence Level") charmType = SingleChoiceField("Charm Type", CHARM_TYPES) duration = SingleChoiceField("Charm Duration", CHARM_DURATIONS) keywords = MultiChoiceField("Charm Keywords", CHARM_KEYWORDS) -class charmMartialArt(charmBase): +class CharmMartialArt(CharmBase): def type(self): return "Martial Art" levelKey = NamedIntegerField("Martial Arts Level") key = None -class charmEvocation(charmBase): +class CharmEvocation(CharmBase): def type(self): return "Evocation" levelKey = 0 - key = NamedForeignKeyField("Artifact", itemBase) + key = NamedForeignKeyField("Artifact", ItemBase) -class charmSolar(charmBase): +class CharmSolar(CharmBase): def type(self): return "Solar" levelKey = NamedIntegerField("Ability Level") key = SingleChoiceField("Key Ability", ABILITIES) -class charmLunar(charmBase): +class CharmLunar(CharmBase): def type(self): return "Lunar" levelKey = NamedIntegerField("Attribute Level") key = SingleChoiceField("Key Attribute", ATTRIBUTES) -class charmLunarShape(charmBase): +class CharmLunarShape(CharmBase): levelKey = 0 def type(self): return "Lunar Shape" @@ -1210,7 +1210,7 @@ class charmLunarShape(charmBase): #==============================================================================# #----------------------------------- MERITS -----------------------------------# #==============================================================================# -class merit(effectBase): +class Merit(EffectBase): dots = DotField("Dots") def dotsDisplay(self): output = [] @@ -1223,62 +1223,62 @@ class merit(effectBase): #==============================================================================# #-------------------------------- SPECIALITIES --------------------------------# #==============================================================================# -class speciality(effectBase): +class Speciality(EffectBase): pass #==============================================================================# #--------------------------------- INTIMACIES ---------------------------------# #==============================================================================# -class intimacyBase(PolymorphicModel): +class IntimacyBase(PolymorphicModel): def __str__(self): return "[{}] {}".format(self.description, self.intensity) description = DescriptionField() intensity = SingleChoiceField("Intensity", INTENSITIES) - character = NamedForeignKeyField("Character", characterBase, related_name="intimacy_set") + character = NamedForeignKeyField("Character", CharacterBase, related_name="intimacy_set") -class intimacyTie(intimacyBase): +class IntimacyTie(IntimacyBase): target = NamedCharField("Target") -class intimacyPrincipal(intimacyBase): +class IntimacyPrincipal(IntimacyBase): pass #==============================================================================# #--------------------------------- OWNERSHIP ----------------------------------# #==============================================================================# -class ownershipBase(PolymorphicModel): +class OwnershipBase(PolymorphicModel): notes = models.TextField(verbose_name="Notes", blank=True) active = NamedBooleanField("Active/Equipped?") -class ownershipItem(ownershipBase): - target = NamedForeignKeyField("Item", item, related_name="ownershipItemTarget_set") - owner = NamedForeignKeyField("Owner", characterBase, related_name="ownershipItem_set") -class ownershipItemWeapon(ownershipBase): - target = NamedForeignKeyField("Weapon", itemWeaponBase, related_name="ownershipItemWeaponTarget_set") - owner = NamedForeignKeyField("Owner", characterBase, related_name="ownershipItemWeapon_set") -class ownershipItemArmor(ownershipBase): - target = NamedForeignKeyField("Armor", itemArmor, related_name="ownershipItemArmorTarget_set") - owner = NamedForeignKeyField("Owner", characterBase, related_name="ownershipItemArmor_set") +class OwnershipItem(OwnershipBase): + target = NamedForeignKeyField("Item", Item, related_name="ownershipItemTarget_set") + owner = NamedForeignKeyField("Owner", CharacterBase, related_name="ownershipItem_set") +class OwnershipItemWeapon(OwnershipBase): + target = NamedForeignKeyField("Weapon", ItemWeaponBase, related_name="ownershipItemWeaponTarget_set") + owner = NamedForeignKeyField("Owner", CharacterBase, related_name="ownershipItemWeapon_set") +class OwnershipItemArmor(OwnershipBase): + target = NamedForeignKeyField("Armor", ItemArmor, related_name="ownershipItemArmorTarget_set") + owner = NamedForeignKeyField("Owner", CharacterBase, related_name="ownershipItemArmor_set") -class ownershipCharmMartialArt(ownershipBase): - target = NamedForeignKeyField("Martial Arts Charm", charmMartialArt, related_name="ownershipCharmMartialArtTarget_set") - owner = NamedForeignKeyField("Exalted Owner", characterExaltBase, related_name="ownershipCharmMartialArt_set") -class ownershipCharmEvocation(ownershipBase): - target = NamedForeignKeyField("Evocation", charmEvocation, related_name="ownershipCharmEvocationTarget_set") - owner = NamedForeignKeyField("Exalted Owner", characterExaltBase, related_name="ownershipCharmEvocation_set") -class ownershipCharmSolar(ownershipBase): - target = NamedForeignKeyField("Solar Charm", charmSolar, related_name="ownershipCharmSolarTarget_set") - owner = NamedForeignKeyField("Solar Exalted Owner", characterExaltSolar, related_name="ownershipCharmSolar_set") -class ownershipCharmLunar(ownershipBase): - target = NamedForeignKeyField("Lunar Charm", charmLunar, related_name="ownershipCharmLunarTarget_set") - owner = NamedForeignKeyField("Lunar Exalted Owner", characterExaltLunar, related_name="ownershipCharmLunar_set") -class ownershipCharmLunarShape(ownershipBase): - target = NamedForeignKeyField("Lunar Shape", charmLunarShape, related_name="ownershipCharmLunarShapeTarget_set") - owner = NamedForeignKeyField("Lunar Exalted Owner", characterExaltLunar, related_name="ownershipCharmLunarShape_set") +class OwnershipCharmMartialArt(OwnershipBase): + target = NamedForeignKeyField("Martial Arts Charm", CharmMartialArt, related_name="ownershipCharmMartialArtTarget_set") + owner = NamedForeignKeyField("Exalted Owner", CharacterExaltBase, related_name="ownershipCharmMartialArt_set") +class OwnershipCharmEvocation(OwnershipBase): + target = NamedForeignKeyField("Evocation", CharmEvocation, related_name="ownershipCharmEvocationTarget_set") + owner = NamedForeignKeyField("Exalted Owner", CharacterExaltBase, related_name="ownershipCharmEvocation_set") +class OwnershipCharmSolar(OwnershipBase): + target = NamedForeignKeyField("Solar Charm", CharmSolar, related_name="ownershipCharmSolarTarget_set") + owner = NamedForeignKeyField("Solar Exalted Owner", CharacterExaltSolar, related_name="ownershipCharmSolar_set") +class OwnershipCharmLunar(OwnershipBase): + target = NamedForeignKeyField("Lunar Charm", CharmLunar, related_name="ownershipCharmLunarTarget_set") + owner = NamedForeignKeyField("Lunar Exalted Owner", CharacterExaltLunar, related_name="ownershipCharmLunar_set") +class OwnershipCharmLunarShape(OwnershipBase): + target = NamedForeignKeyField("Lunar Shape", CharmLunarShape, related_name="ownershipCharmLunarShapeTarget_set") + owner = NamedForeignKeyField("Lunar Exalted Owner", CharacterExaltLunar, related_name="ownershipCharmLunarShape_set") -class ownershipMerit(ownershipBase): - target = NamedForeignKeyField("Merit", merit, related_name="ownershipMeritTarget_set") - owner = NamedForeignKeyField("Owner", characterBase, related_name="ownershipMerit_set") +class OwnershipMerit(OwnershipBase): + target = NamedForeignKeyField("Merit", Merit, related_name="ownershipMeritTarget_set") + owner = NamedForeignKeyField("Owner", CharacterBase, related_name="ownershipMerit_set") -class ownershipSpeciality(ownershipBase): - target = NamedForeignKeyField("Speciality", speciality, related_name="ownershipSpecialityTarget_set") - owner = NamedForeignKeyField("Owner", characterBase, related_name="ownershipSpeciality_set") +class OwnershipSpeciality(OwnershipBase): + target = NamedForeignKeyField("Speciality", Speciality, related_name="ownershipSpecialityTarget_set") + owner = NamedForeignKeyField("Owner", CharacterBase, related_name="ownershipSpeciality_set") diff --git a/app/views.py b/app/views.py index dd39f76..b2fd106 100644 --- a/app/views.py +++ b/app/views.py @@ -7,5 +7,5 @@ class HomePageView(TemplateView): template_name = "home.html" class CharacterDetailView(DetailView): - model = characterBase + model = CharacterBase template_name = "characterDetail.html"