diff --git a/app/__pycache__/models.cpython-38.pyc b/app/__pycache__/models.cpython-38.pyc index 7375b47..4b7163f 100644 Binary files a/app/__pycache__/models.cpython-38.pyc and b/app/__pycache__/models.cpython-38.pyc differ diff --git a/app/migrations/0013_charm_rollconfiguration.py b/app/migrations/0013_charm_rollconfiguration.py new file mode 100644 index 0000000..f69e8bf --- /dev/null +++ b/app/migrations/0013_charm_rollconfiguration.py @@ -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'), + ), + ] diff --git a/app/migrations/0014_auto_20200411_1428.py b/app/migrations/0014_auto_20200411_1428.py new file mode 100644 index 0000000..e0783d0 --- /dev/null +++ b/app/migrations/0014_auto_20200411_1428.py @@ -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'), + ), + ] diff --git a/app/migrations/__pycache__/0013_charm_rollconfiguration.cpython-38.pyc b/app/migrations/__pycache__/0013_charm_rollconfiguration.cpython-38.pyc new file mode 100644 index 0000000..9992da9 Binary files /dev/null and b/app/migrations/__pycache__/0013_charm_rollconfiguration.cpython-38.pyc differ diff --git a/app/migrations/__pycache__/0014_auto_20200411_1428.cpython-38.pyc b/app/migrations/__pycache__/0014_auto_20200411_1428.cpython-38.pyc new file mode 100644 index 0000000..e1bf489 Binary files /dev/null and b/app/migrations/__pycache__/0014_auto_20200411_1428.cpython-38.pyc differ diff --git a/app/models.py b/app/models.py index 337dce0..c1119d3 100644 --- a/app/models.py +++ b/app/models.py @@ -229,6 +229,28 @@ class DieField(multiselectfield.MultiSelectField): kwargs['number'] = self.number 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 --------------------------------# #==============================================================================# @@ -364,10 +386,10 @@ class itemArmor(itemBase): class charm(models.Model): name = NameField() description = DescriptionField() - # modifierAttribute - # modifierAbility - # modifierStatic - # rollConfiguration + modifierAttribute = NamedManyToManyField("Attribute Modifiers", modifierAttribute) + modifierAbility = NamedManyToManyField("Abilities Modifiers", modifierAbility) + modifierStatic = NamedManyToManyField("Statics Modifiers", modifierStatic) + rollConfiguration = NamedManyToManyField("Roll Configurations", rollConfiguration) #==============================================================================# #----------------------------------- MERITS -----------------------------------#