Commit f9433347 authored by Claude Paroz's avatar Claude Paroz

Added missing on_delete arguments to avoid warnings

parent b06ab3d8
......@@ -15,7 +15,7 @@ class Migration(migrations.Migration):
('name', models.CharField(unique=True, max_length=50)),
('locale', models.CharField(unique=True, max_length=15)),
('plurals', models.CharField(max_length=200, blank=True)),
('team', models.ForeignKey(default=None, blank=True, to='teams.Team', null=True)),
('team', models.ForeignKey(default=None, blank=True, to='teams.Team', null=True, on_delete=models.SET_NULL)),
],
options={
'ordering': ('name',),
......
......@@ -8,7 +8,7 @@ from teams.models import Team, FakeTeam
class Language(models.Model):
name = models.CharField(max_length=50, unique=True)
locale = models.CharField(max_length=15, unique=True)
team = models.ForeignKey(Team, null=True, blank=True, default=None)
team = models.ForeignKey(Team, null=True, blank=True, default=None, on_delete=models.SET_NULL)
plurals = models.CharField(max_length=200, blank=True)
class Meta:
......
......@@ -13,7 +13,7 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='Person',
fields=[
('user_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL)),
('user_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)),
('svn_account', models.SlugField(max_length=20, null=True, blank=True)),
('image', models.URLField(help_text='URL to an image file (.jpg, .png, ...) of an hackergotchi (max. 100x100 pixels)', null=True, verbose_name='Image', blank=True)),
('use_gravatar', models.BooleanField(default=False, help_text='Display the image of your gravatar.com account')),
......
......@@ -31,7 +31,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(default='default', max_length=30, choices=[('default', 'Default'), ('admin-tools', 'Administration Tools'), ('dev-tools', 'Development Tools'), ('desktop', 'GNOME Desktop'), ('dev-platform', 'GNOME Developer Platform'), ('proposed', 'New Module Proposals'), ('g3-core', 'Core'), ('g3-utils', 'Utils'), ('g3-apps', 'Apps'), ('g3-a11y', 'Accessibility'), ('g3-games', 'Games'), ('g3-backends', 'Backends'), ('g3-dev-tools', 'Development Tools'), ('g3-core-libs', 'Core Libraries'), ('g3-extra-libs', 'Extra Libraries'), ('g2-legacy', 'Legacy Desktop'), ('stable', 'Stable Branches'), ('dev', 'Development Branches')])),
('branch', models.ForeignKey(to='stats.Branch')),
('branch', models.ForeignKey(to='stats.Branch', on_delete=models.CASCADE)),
],
options={
'db_table': 'category',
......@@ -138,10 +138,10 @@ class Migration(migrations.Migration):
name='Statistics',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('branch', models.ForeignKey(to='stats.Branch')),
('domain', models.ForeignKey(to='stats.Domain')),
('branch', models.ForeignKey(to='stats.Branch', on_delete=models.CASCADE)),
('domain', models.ForeignKey(to='stats.Domain', on_delete=models.CASCADE)),
('full_po', models.OneToOneField(related_name='stat_f', null=True, on_delete=django.db.models.deletion.SET_NULL, to='stats.PoFile')),
('language', models.ForeignKey(to='languages.Language', null=True)),
('language', models.ForeignKey(to='languages.Language', null=True, on_delete=models.CASCADE)),
('part_po', models.OneToOneField(related_name='stat_p', null=True, on_delete=django.db.models.deletion.SET_NULL, to='stats.PoFile')),
],
options={
......@@ -171,27 +171,27 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='informationarchived',
name='statistics',
field=models.ForeignKey(to='stats.StatisticsArchived'),
field=models.ForeignKey(to='stats.StatisticsArchived', on_delete=models.CASCADE),
),
migrations.AddField(
model_name='information',
name='statistics',
field=models.ForeignKey(to='stats.Statistics'),
field=models.ForeignKey(to='stats.Statistics', on_delete=models.CASCADE),
),
migrations.AddField(
model_name='domain',
name='module',
field=models.ForeignKey(to='stats.Module'),
field=models.ForeignKey(to='stats.Module', on_delete=models.CASCADE),
),
migrations.AddField(
model_name='category',
name='release',
field=models.ForeignKey(to='stats.Release'),
field=models.ForeignKey(to='stats.Release', on_delete=models.CASCADE),
),
migrations.AddField(
model_name='branch',
name='module',
field=models.ForeignKey(to='stats.Module'),
field=models.ForeignKey(to='stats.Module', on_delete=models.CASCADE),
),
migrations.AlterUniqueTogether(
name='statistics',
......
......@@ -196,7 +196,7 @@ class Branch(models.Model):
name = models.CharField(max_length=50)
#description = models.TextField(null=True)
vcs_subpath = models.CharField(max_length=50, null=True, blank=True)
module = models.ForeignKey(Module)
module = models.ForeignKey(Module, on_delete=models.CASCADE)
weight = models.IntegerField(default=0, help_text="Smaller weight is displayed first")
file_hashes = DictionaryField(default='', blank=True, editable=False)
# 'releases' is the backward relation name from Release model
......@@ -734,7 +734,7 @@ DOMAIN_TYPE_CHOICES = (
)
class Domain(models.Model):
module = models.ForeignKey(Module)
module = models.ForeignKey(Module, on_delete=models.CASCADE)
name = models.CharField(max_length=50)
description = models.TextField(null=True, blank=True)
dtype = models.CharField(max_length=5, choices=DOMAIN_TYPE_CHOICES, default='ui')
......@@ -1181,8 +1181,8 @@ class CategoryName(models.Model):
class Category(models.Model):
release = models.ForeignKey(Release)
branch = models.ForeignKey(Branch)
release = models.ForeignKey(Release, on_delete=models.CASCADE)
branch = models.ForeignKey(Branch, on_delete=models.CASCADE)
name = models.ForeignKey(CategoryName, on_delete=models.PROTECT)
class Meta:
......@@ -1287,9 +1287,9 @@ class PoFile(models.Model):
class Statistics(models.Model):
branch = models.ForeignKey(Branch)
domain = models.ForeignKey(Domain)
language = models.ForeignKey(Language, null=True)
branch = models.ForeignKey(Branch, on_delete=models.CASCADE)
domain = models.ForeignKey(Domain, on_delete=models.CASCADE)
language = models.ForeignKey(Language, null=True, on_delete=models.CASCADE)
full_po = models.OneToOneField(PoFile, null=True, related_name='stat_f', on_delete=models.SET_NULL)
part_po = models.OneToOneField(PoFile, null=True, related_name='stat_p', on_delete=models.SET_NULL)
......@@ -1836,7 +1836,7 @@ INFORMATION_TYPE_CHOICES = (
('error-ext','Error (external)')
)
class Information(models.Model):
statistics = models.ForeignKey('Statistics')
statistics = models.ForeignKey('Statistics', on_delete=models.CASCADE)
# Priority of a stats message
type = models.CharField(max_length=10, choices=INFORMATION_TYPE_CHOICES)
description = models.TextField()
......@@ -1884,7 +1884,7 @@ class Information(models.Model):
return link
class InformationArchived(models.Model):
statistics = models.ForeignKey('StatisticsArchived')
statistics = models.ForeignKey('StatisticsArchived', on_delete=models.CASCADE)
# Priority of a stats message
type = models.CharField(max_length=10, choices=INFORMATION_TYPE_CHOICES)
description = models.TextField()
......
......@@ -14,7 +14,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('role', models.CharField(default='translator', max_length=15, choices=[('translator', 'Translator'), ('reviewer', 'Reviewer'), ('committer', 'Committer'), ('coordinator', 'Coordinator')])),
('is_active', models.BooleanField(default=True)),
('person', models.ForeignKey(to='people.Person')),
('person', models.ForeignKey(to='people.Person', on_delete=models.CASCADE)),
],
options={
'db_table': 'role',
......@@ -41,7 +41,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='role',
name='team',
field=models.ForeignKey(to='teams.Team'),
field=models.ForeignKey(to='teams.Team', on_delete=models.CASCADE),
),
migrations.AlterUniqueTogether(
name='role',
......
......@@ -245,8 +245,8 @@ class Role(models.Model):
This is the intermediary class between Person and Team to attribute roles to
Team members.
"""
team = models.ForeignKey(Team)
person = models.ForeignKey(Person)
team = models.ForeignKey(Team, on_delete=models.CASCADE)
person = models.ForeignKey(Person, on_delete=models.CASCADE)
role = models.CharField(max_length=15, choices=ROLE_CHOICES,
default='translator')
is_active = models.BooleanField(default=True)
......
......@@ -19,8 +19,8 @@ class Migration(migrations.Migration):
('created', models.DateTimeField(editable=False)),
('comment', models.TextField(null=True, blank=True)),
('file', models.FileField(null=True, upload_to=vertimus.models.generate_upload_filename, blank=True)),
('merged_file', models.OneToOneField(null=True, blank=True, to='stats.PoFile')),
('person', models.ForeignKey(to='people.Person')),
('merged_file', models.OneToOneField(null=True, blank=True, to='stats.PoFile', on_delete=models.SET_NULL)),
('person', models.ForeignKey(to='people.Person', on_delete=models.CASCADE)),
],
options={
'db_table': 'action',
......@@ -36,8 +36,8 @@ class Migration(migrations.Migration):
('comment', models.TextField(null=True, blank=True)),
('file', models.FileField(null=True, upload_to=vertimus.models.generate_upload_filename, blank=True)),
('sequence', models.IntegerField(null=True)),
('merged_file', models.OneToOneField(null=True, blank=True, to='stats.PoFile')),
('person', models.ForeignKey(to='people.Person')),
('merged_file', models.OneToOneField(null=True, blank=True, to='stats.PoFile', on_delete=models.SET_NULL)),
('person', models.ForeignKey(to='people.Person', on_delete=models.CASCADE)),
],
options={
'db_table': 'action_archived',
......@@ -49,10 +49,10 @@ class Migration(migrations.Migration):
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.SlugField(default='None', max_length=20)),
('updated', models.DateTimeField(auto_now=True)),
('branch', models.ForeignKey(to='stats.Branch')),
('domain', models.ForeignKey(to='stats.Domain')),
('language', models.ForeignKey(to='languages.Language')),
('person', models.ForeignKey(default=None, to='people.Person', null=True)),
('branch', models.ForeignKey(to='stats.Branch', on_delete=models.CASCADE)),
('domain', models.ForeignKey(to='stats.Domain', on_delete=models.CASCADE)),
('language', models.ForeignKey(to='languages.Language', on_delete=models.CASCADE)),
('person', models.ForeignKey(default=None, to='people.Person', null=True, on_delete=models.SET_NULL)),
],
options={
'db_table': 'state',
......@@ -62,12 +62,12 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='actionarchived',
name='state_db',
field=models.ForeignKey(to='vertimus.State'),
field=models.ForeignKey(to='vertimus.State', on_delete=models.CASCADE),
),
migrations.AddField(
model_name='action',
name='state_db',
field=models.ForeignKey(to='vertimus.State'),
field=models.ForeignKey(to='vertimus.State', on_delete=models.CASCADE),
),
migrations.CreateModel(
name='ActionAA',
......
......@@ -11,6 +11,6 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='state',
name='person',
field=models.ForeignKey(blank=True, to='people.Person', null=True),
field=models.ForeignKey(blank=True, to='people.Person', null=True, on_delete=models.SET_NULL),
),
]
......@@ -49,10 +49,10 @@ class SendMailFailed(Exception):
class State(models.Model):
"""State of a module translation"""
branch = models.ForeignKey(Branch)
domain = models.ForeignKey(Domain)
language = models.ForeignKey(Language)
person = models.ForeignKey(Person, blank=True, null=True)
branch = models.ForeignKey(Branch, on_delete=models.CASCADE)
domain = models.ForeignKey(Domain, on_delete=models.CASCADE)
language = models.ForeignKey(Language, on_delete=models.CASCADE)
person = models.ForeignKey(Person, blank=True, null=True, on_delete=models.SET_NULL)
name = models.SlugField(max_length=20, default='None')
updated = models.DateTimeField(auto_now=True, editable=False)
......@@ -345,8 +345,8 @@ def generate_upload_filename(instance, filename):
class ActionAbstract(models.Model):
""" Common model for Action and ActionArchived """
state_db = models.ForeignKey(State)
person = models.ForeignKey(Person)
state_db = models.ForeignKey(State, on_delete=models.CASCADE)
person = models.ForeignKey(Person, on_delete=models.CASCADE)
name = models.SlugField(max_length=8)
created = models.DateTimeField(editable=False)
......@@ -354,7 +354,7 @@ class ActionAbstract(models.Model):
sent_to_ml = models.BooleanField(default=False)
file = models.FileField(upload_to=generate_upload_filename, blank=True, null=True)
#up_file = models.OneToOneField(PoFile, null=True, related_name='action_p')
merged_file = models.OneToOneField(PoFile, blank=True, null=True) #, related_name='action_m')
merged_file = models.OneToOneField(PoFile, blank=True, null=True, on_delete=models.SET_NULL) #, related_name='action_m')
# A comment or a file is required
arg_is_required = False
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment