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
  • Loading branch information
afuetterer committed Oct 16, 2023
1 parent bb5f093 commit 2724815
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 16 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
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
4 changes: 2 additions & 2 deletions rdmo/tasks/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

class Task(TranslationMixin, models.Model):

objects = TaskManager()

uri = models.URLField(
max_length=800, blank=True,
verbose_name=_('URI'),
Expand Down Expand Up @@ -145,6 +143,8 @@ class Task(TranslationMixin, models.Model):
help_text=_('Designates whether this task is generally available for projects.')
)

objects = TaskManager()

class Meta:
ordering = ('uri',)
verbose_name = _('Task')
Expand Down
4 changes: 2 additions & 2 deletions rdmo/views/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

class View(models.Model, TranslationMixin):

objects = ViewManager()

uri = models.URLField(
max_length=800, blank=True,
verbose_name=_('URI'),
Expand Down Expand Up @@ -125,6 +123,8 @@ class View(models.Model, TranslationMixin):
help_text=_('Designates whether this view is generally available for projects.')
)

objects = ViewManager()

class Meta:
ordering = ('uri', )
verbose_name = _('View')
Expand Down

0 comments on commit 2724815

Please sign in to comment.