Charms. Migrations.

This commit is contained in:
tcaxle 2020-04-11 15:29:21 +01:00
parent 858d6dc07d
commit e73ad78787
6 changed files with 84 additions and 4 deletions

View File

@ -0,0 +1,20 @@
# Generated by Django 3.0.5 on 2020-04-11 14:23
import app.models
from django.db import migrations
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('app', '0012_auto_20200411_1414'),
]
operations = [
migrations.AddField(
model_name='charm',
name='rollConfiguration',
field=app.models.NamedForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='app.rollConfiguration', verbose_name='Roll Configuration'),
),
]

View File

@ -0,0 +1,38 @@
# Generated by Django 3.0.5 on 2020-04-11 14:28
import app.models
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('app', '0013_charm_rollconfiguration'),
]
operations = [
migrations.AddField(
model_name='charm',
name='modifierAbility',
field=app.models.NamedManyToManyField(blank=True, null=True, to='app.modifierAbility', verbose_name='Abilities Modifiers'),
),
migrations.AddField(
model_name='charm',
name='modifierAttribute',
field=app.models.NamedManyToManyField(blank=True, null=True, to='app.modifierAttribute', verbose_name='Attribute Modifiers'),
),
migrations.AddField(
model_name='charm',
name='modifierStatic',
field=app.models.NamedManyToManyField(blank=True, null=True, to='app.modifierStatic', verbose_name='Statics Modifiers'),
),
migrations.RemoveField(
model_name='charm',
name='rollConfiguration',
),
migrations.AddField(
model_name='charm',
name='rollConfiguration',
field=app.models.NamedManyToManyField(blank=True, null=True, to='app.rollConfiguration', verbose_name='Roll Configurations'),
),
]

View File

@ -229,6 +229,28 @@ class DieField(multiselectfield.MultiSelectField):
kwargs['number'] = self.number kwargs['number'] = self.number
return name, path, args, kwargs return name, path, args, kwargs
class NamedForeignKey(models.ForeignKey):
def __init__(self, verbose_name, *args, **kwargs):
kwargs['verbose_name'] = verbose_name
kwargs['on_delete'] = models.CASCADE
kwargs['blank'] = True
kwargs['null'] = True
super().__init__(*args, **kwargs)
class NamedManyToManyField(models.ManyToManyField):
def __init__(self, verbose_name, *args, **kwargs):
kwargs['verbose_name'] = verbose_name
kwargs['blank'] = True
super().__init__(*args, **kwargs)
class NamedOneToOneField(models.OneToOneField):
def __init__(self, verbose_name, *args, **kwargs):
kwargs['verbose_name'] = verbose_name
kwargs['on_delete'] = models.CASCADE
kwargs['blank'] = True
kwargs['null'] = True
super().__init__(*args, **kwargs)
#==============================================================================# #==============================================================================#
#-------------------------------- DICE ROLLING --------------------------------# #-------------------------------- DICE ROLLING --------------------------------#
#==============================================================================# #==============================================================================#
@ -364,10 +386,10 @@ class itemArmor(itemBase):
class charm(models.Model): class charm(models.Model):
name = NameField() name = NameField()
description = DescriptionField() description = DescriptionField()
# modifierAttribute modifierAttribute = NamedManyToManyField("Attribute Modifiers", modifierAttribute)
# modifierAbility modifierAbility = NamedManyToManyField("Abilities Modifiers", modifierAbility)
# modifierStatic modifierStatic = NamedManyToManyField("Statics Modifiers", modifierStatic)
# rollConfiguration rollConfiguration = NamedManyToManyField("Roll Configurations", rollConfiguration)
#==============================================================================# #==============================================================================#
#----------------------------------- MERITS -----------------------------------# #----------------------------------- MERITS -----------------------------------#