[v2] Alliance and Corp Autogroups (#902)

* Add pseudo foreign keys to EveCharacter model

* Ensure populate alliance is called on create

* Add unit tests for model

* Add extra signal for state removal/addition

* Add unit tests for signals

* Add tests for manager

* Add migrations

* Add sync command to admin control

* Prevent whitespace being stripped from group names

* Add documentation
This commit is contained in:
Basraah
2017-12-04 12:52:05 +10:00
committed by GitHub
parent 995a44de0a
commit 70c4b17518
15 changed files with 1075 additions and 0 deletions

View File

@@ -0,0 +1,77 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-29 14:44
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('authentication', '0015_user_profiles'),
('auth', '0008_alter_user_username_max_length'),
('eveonline', '0009_on_delete'),
]
operations = [
migrations.CreateModel(
name='AutogroupsConfig',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('corp_groups', models.BooleanField(default=False, help_text='Setting this to false will delete all the created groups.')),
('corp_group_prefix', models.CharField(blank=True, default='Corp ', max_length=50)),
('corp_name_source', models.CharField(choices=[('ticker', 'Ticker'), ('name', 'Full name')], default='name', max_length=20)),
('alliance_groups', models.BooleanField(default=False, help_text='Setting this to false will delete all the created groups.')),
('alliance_group_prefix', models.CharField(blank=True, default='Alliance ', max_length=50)),
('alliance_name_source', models.CharField(choices=[('ticker', 'Ticker'), ('name', 'Full name')], default='name', max_length=20)),
('replace_spaces', models.BooleanField(default=False)),
('replace_spaces_with', models.CharField(blank=True, default='', help_text='Any spaces in the group name will be replaced with this.', max_length=10)),
('states', models.ManyToManyField(related_name='autogroups', to='authentication.State')),
],
),
migrations.CreateModel(
name='ManagedGroup',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
],
),
migrations.CreateModel(
name='ManagedAllianceGroup',
fields=[
('managedgroup_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='eve_autogroups.ManagedGroup')),
('alliance', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='eveonline.EveAllianceInfo')),
],
bases=('eve_autogroups.managedgroup',),
),
migrations.CreateModel(
name='ManagedCorpGroup',
fields=[
('managedgroup_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='eve_autogroups.ManagedGroup')),
('corp', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='eveonline.EveCorporationInfo')),
],
bases=('eve_autogroups.managedgroup',),
),
migrations.AddField(
model_name='managedgroup',
name='config',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='eve_autogroups.AutogroupsConfig'),
),
migrations.AddField(
model_name='managedgroup',
name='group',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='auth.Group'),
),
migrations.AddField(
model_name='autogroupsconfig',
name='alliance_managed_groups',
field=models.ManyToManyField(help_text="A list of alliance groups created and maintained by this AutogroupConfig. You should not edit this list unless you know what you're doing.", related_name='alliance_managed_config', through='eve_autogroups.ManagedAllianceGroup', to='auth.Group'),
),
migrations.AddField(
model_name='autogroupsconfig',
name='corp_managed_groups',
field=models.ManyToManyField(help_text="A list of corporation groups created and maintained by this AutogroupConfig. You should not edit this list unless you know what you're doing.", related_name='corp_managed_config', through='eve_autogroups.ManagedCorpGroup', to='auth.Group'),
),
]