Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: enable flake8-django (DJ) rule in ruff config #779

Merged
merged 1 commit into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,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 = [
afuetterer marked this conversation as resolved.
Show resolved Hide resolved
'uri',
'uri_prefix',
'key',
'path',
'comment',
'locked',
'editors',
'parent',
]

def clean(self):
AttributeUniqueURIValidator(self.instance)(self.cleaned_data)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Generated by Django 4.2.7 on 2023-11-28 06:07

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("options", "0034_option_view_text"),
]

operations = [
migrations.AlterField(
model_name="option",
name="help_lang1",
field=models.TextField(
blank=True,
default="",
help_text="The help text for this option in the primary language.",
verbose_name="Help (primary)",
),
),
migrations.AlterField(
model_name="option",
name="help_lang2",
field=models.TextField(
blank=True,
default="",
help_text="The help text for this option in the secondary language.",
verbose_name="Help (secondary)",
),
),
migrations.AlterField(
model_name="option",
name="help_lang3",
field=models.TextField(
blank=True,
default="",
help_text="The help text for this option in the tertiary language.",
verbose_name="Help (tertiary)",
),
),
migrations.AlterField(
model_name="option",
name="help_lang4",
field=models.TextField(
blank=True,
default="",
help_text="The help text for this option in the quaternary language.",
verbose_name="Help (quaternary)",
),
),
migrations.AlterField(
model_name="option",
name="help_lang5",
field=models.TextField(
blank=True,
default="",
help_text="The help text for this option in the quinary language.",
verbose_name="Help (quinary)",
),
),
migrations.AlterField(
model_name="option",
name="view_text_lang1",
field=models.TextField(
blank=True,
default="",
help_text="The view text for this option in the primary language.",
verbose_name="View text (primary)",
),
),
migrations.AlterField(
model_name="option",
name="view_text_lang2",
field=models.TextField(
blank=True,
default="",
help_text="The view text for this option in the secondary language.",
verbose_name="View text (secondary)",
),
),
migrations.AlterField(
model_name="option",
name="view_text_lang3",
field=models.TextField(
blank=True,
default="",
help_text="The view text for this option in the tertiary language.",
verbose_name="View text (tertiary)",
),
),
migrations.AlterField(
model_name="option",
name="view_text_lang4",
field=models.TextField(
blank=True,
default="",
help_text="The view text for this option in the quaternary language.",
verbose_name="View text (quaternary)",
),
),
migrations.AlterField(
model_name="option",
name="view_text_lang5",
field=models.TextField(
blank=True,
default="",
help_text="The view text for this option in the quinary language.",
verbose_name="View text (quinary)",
),
),
]
20 changes: 10 additions & 10 deletions rdmo/options/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,52 +212,52 @@ class Option(models.Model, TranslationMixin):
help_text=_('The text for this option in the quinary language.')
)
help_lang1 = models.TextField(
null=True, blank=True,
blank=True, default="",
verbose_name=_('Help (primary)'),
help_text=_('The help text for this option in the primary language.')
)
help_lang2 = models.TextField(
null=True, blank=True,
blank=True, default="",
verbose_name=_('Help (secondary)'),
help_text=_('The help text for this option in the secondary language.')
)
help_lang3 = models.TextField(
null=True, blank=True,
blank=True, default="",
verbose_name=_('Help (tertiary)'),
help_text=_('The help text for this option in the tertiary language.')
)
help_lang4 = models.TextField(
null=True, blank=True,
blank=True, default="",
verbose_name=_('Help (quaternary)'),
help_text=_('The help text for this option in the quaternary language.')
)
help_lang5 = models.TextField(
null=True, blank=True,
blank=True, default="",
verbose_name=_('Help (quinary)'),
help_text=_('The help text for this option in the quinary language.')
)
view_text_lang1 = models.TextField(
null=True, blank=True,
blank=True, default="",
verbose_name=_('View text (primary)'),
help_text=_('The view text for this option in the primary language.')
)
view_text_lang2 = models.TextField(
null=True, blank=True,
blank=True, default="",
verbose_name=_('View text (secondary)'),
help_text=_('The view text for this option in the secondary language.')
)
view_text_lang3 = models.TextField(
null=True, blank=True,
blank=True, default="",
verbose_name=_('View text (tertiary)'),
help_text=_('The view text for this option in the tertiary language.')
)
view_text_lang4 = models.TextField(
null=True, blank=True,
blank=True, default="",
verbose_name=_('View text (quaternary)'),
help_text=_('The view text for this option in the quaternary language.')
)
view_text_lang5 = models.TextField(
null=True, blank=True,
blank=True, default="",
verbose_name=_('View text (quinary)'),
help_text=_('The view text for this option in the quinary language.')
)
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()
afuetterer marked this conversation as resolved.
Show resolved Hide resolved

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 get_option_value(self, key):
try:
return self.options.get(key=key).value
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', 'task__uri')
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
Loading