Skip to content

Commit

Permalink
chore: enable flake8-django (DJ) rule in ruff config
Browse files Browse the repository at this point in the history
Fixes: #766
  • Loading branch information
afuetterer committed Oct 20, 2023
1 parent 12a55af commit 03213a8
Show file tree
Hide file tree
Showing 14 changed files with 917 additions and 655 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ line-length = 120
select = [
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"DJ", # flake8-django
"E", # pycodestyle
"F", # pyflakes
"I", # isort
Expand Down
13 changes: 12 additions & 1 deletion rdmo/conditions/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,18 @@ class ConditionAdminForm(forms.ModelForm):

class Meta:
model = Condition
fields = '__all__'
fields = [
"uri",
"uri_prefix",
"uri_path",
"comment",
"locked",
"editors",
"source",
"relation",
"target_text",
"target_option",
]

def clean(self):
ConditionUniqueURIValidator(self.instance)(self.cleaned_data)
Expand Down
11 changes: 10 additions & 1 deletion rdmo/domain/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,16 @@ class AttributeAdminForm(forms.ModelForm):

class Meta:
model = Attribute
fields = '__all__'
fields = [
'uri',
'uri_prefix',
'key',
'path',
'comment',
'locked',
'editors',
'parent',
]

def clean(self):
AttributeUniqueURIValidator(self.instance)(self.cleaned_data)
Expand Down
10 changes: 5 additions & 5 deletions rdmo/projects/models/integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

class Integration(models.Model):

objects = IntegrationManager()

project = models.ForeignKey(
'Project', on_delete=models.CASCADE, related_name='integrations',
verbose_name=_('Project'),
Expand All @@ -21,6 +19,8 @@ class Integration(models.Model):
help_text=_('The key of the provider for this integration.')
)

objects = IntegrationManager()

class Meta:
ordering = ('project__title', )
verbose_name = _('Integration')
Expand All @@ -29,13 +29,13 @@ class Meta:
def __str__(self):
return f'{self.project.title} / {self.provider_key}'

def get_absolute_url(self):
return reverse('project', kwargs={'pk': self.project.pk})

@property
def provider(self):
return get_plugin('PROJECT_ISSUE_PROVIDERS', self.provider_key)

def get_absolute_url(self):
return reverse('project', kwargs={'pk': self.project.pk})

def save_options(self, options):
for field in self.provider.fields:
try:
Expand Down
4 changes: 2 additions & 2 deletions rdmo/projects/models/invite.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ class Invite(models.Model):

key_salt = 'rdmo.projects.models.invite.Invite'

objects = InviteManager()

project = models.ForeignKey(
'Project', on_delete=models.CASCADE, related_name='invites',
verbose_name=_('Project'),
Expand Down Expand Up @@ -45,6 +43,8 @@ class Invite(models.Model):
help_text=_('The timestamp for this invite.')
)

objects = InviteManager()

class Meta:
ordering = ('timestamp', )
verbose_name = _('Invite')
Expand Down
3 changes: 1 addition & 2 deletions rdmo/projects/models/issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

class Issue(models.Model):

objects = IssueManager()

ISSUE_STATUS_OPEN = 'open'
ISSUE_STATUS_IN_PROGRESS = 'in_progress'
ISSUE_STATUS_CLOSED = 'closed'
Expand All @@ -39,6 +37,7 @@ class Issue(models.Model):
help_text=_('The status for this issue.')
)

objects = IssueManager()
class Meta:
ordering = ('project__title', )
verbose_name = _('Issue')
Expand Down
4 changes: 2 additions & 2 deletions rdmo/projects/models/membership.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

class Membership(models.Model):

objects = MembershipManager()

ROLE_CHOICES = (
('owner', _('Owner')),
('manager', _('Manager')),
Expand All @@ -33,6 +31,8 @@ class Membership(models.Model):
help_text=_('The role for this membership.')
)

objects = MembershipManager()

class Meta:
ordering = ('project__title', )
verbose_name = _('Membership')
Expand Down
194 changes: 194 additions & 0 deletions rdmo/questions/migrations/0091_alter_question_comment_and_more.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
# Generated by Django 4.2.6 on 2023-10-20 08:42

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("questions", "0090_add_editors"),
]

operations = [
migrations.AlterField(
model_name="question",
name="comment",
field=models.TextField(
blank=True,
default="",
help_text="Additional internal information about this question.",
verbose_name="Comment",
),
),
migrations.AlterField(
model_name="question",
name="default_text_lang1",
field=models.TextField(
blank=True,
default="",
help_text="The default text value for this question in the primary language.",
verbose_name="Default text value (primary)",
),
),
migrations.AlterField(
model_name="question",
name="default_text_lang2",
field=models.TextField(
blank=True,
default="",
help_text="The default text value for this question in the secondary language.",
verbose_name="Default text value (secondary)",
),
),
migrations.AlterField(
model_name="question",
name="default_text_lang3",
field=models.TextField(
blank=True,
default="",
help_text="The default text value for this question in the tertiary language.",
verbose_name="Default text value (tertiary)",
),
),
migrations.AlterField(
model_name="question",
name="default_text_lang4",
field=models.TextField(
blank=True,
default="",
help_text="The default text value for this question in the quaternary language.",
verbose_name="Default text value (quaternary)",
),
),
migrations.AlterField(
model_name="question",
name="default_text_lang5",
field=models.TextField(
blank=True,
default="",
help_text="The default text value for this question in the quinary language.",
verbose_name="Default text value (quinary)",
),
),
migrations.AlterField(
model_name="question",
name="help_lang1",
field=models.TextField(
blank=True,
default="",
help_text="The help text for this question in the primary language.",
verbose_name="Help (primary)",
),
),
migrations.AlterField(
model_name="question",
name="help_lang2",
field=models.TextField(
blank=True,
default="",
help_text="The help text for this question in the secondary language.",
verbose_name="Help (secondary)",
),
),
migrations.AlterField(
model_name="question",
name="help_lang3",
field=models.TextField(
blank=True,
default="",
help_text="The help text for this question in the tertiary language.",
verbose_name="Help (tertiary)",
),
),
migrations.AlterField(
model_name="question",
name="help_lang4",
field=models.TextField(
blank=True,
default="",
help_text="The help text for this question in the quaternary language.",
verbose_name="Help (quaternary)",
),
),
migrations.AlterField(
model_name="question",
name="help_lang5",
field=models.TextField(
blank=True,
default="",
help_text="The help text for this question in the quinary language.",
verbose_name="Help (quinary)",
),
),
migrations.AlterField(
model_name="question",
name="text_lang1",
field=models.TextField(
blank=True,
default="",
help_text="The text for this question in the primary language.",
verbose_name="Text (primary)",
),
),
migrations.AlterField(
model_name="question",
name="text_lang2",
field=models.TextField(
blank=True,
default="",
help_text="The text for this question in the secondary language.",
verbose_name="Text (secondary)",
),
),
migrations.AlterField(
model_name="question",
name="text_lang3",
field=models.TextField(
blank=True,
default="",
help_text="The text for this question in the tertiary language.",
verbose_name="Text (tertiary)",
),
),
migrations.AlterField(
model_name="question",
name="text_lang4",
field=models.TextField(
blank=True,
default="",
help_text="The text for this question in the quaternary language.",
verbose_name="Text (quaternary)",
),
),
migrations.AlterField(
model_name="question",
name="text_lang5",
field=models.TextField(
blank=True,
default="",
help_text="The text for this question in the quinary language.",
verbose_name="Text (quinary)",
),
),
migrations.AlterField(
model_name="question",
name="uri",
field=models.URLField(
blank=True,
default="",
help_text="The Uniform Resource Identifier of this question (auto-generated).",
max_length=800,
verbose_name="URI",
),
),
migrations.AlterField(
model_name="question",
name="uri_path",
field=models.CharField(
blank=True,
default="",
help_text="The path for the URI of this question.",
max_length=512,
verbose_name="URI Path",
),
),
]
Loading

0 comments on commit 03213a8

Please sign in to comment.