Skip to content

Commit 2c617aa

Browse files
committed
treewide: add missing __str__ methods for models
1 parent 2baf099 commit 2c617aa

3 files changed

Lines changed: 6 additions & 1 deletion

File tree

devel/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ def get_absolute_url(self):
7474
return '%s#%s' % (group.get_absolute_url(), user.username)
7575
return None
7676

77+
def __str__(self):
78+
return f"{self.user}"
79+
7780

7881
class StaffGroup(models.Model):
7982
name = models.CharField(max_length=100)

packages/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,9 @@ def __str__(self):
227227
class FlagDenylist(models.Model):
228228
keyword = models.CharField(max_length=255)
229229

230+
def __str__(self):
231+
return f"{self.keyword}"
232+
230233

231234
class UpdateManager(models.Manager):
232235
def log_update(self, old_pkg, new_pkg):

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,5 @@ ignore = [
8080
# TODO: add these one by one
8181
"DJ001", # Avoid using `null=True` on string-based fields such as `CharField`
8282
"DJ006", # Do not use `exclude` with `ModelForm`, use `fields` instead
83-
"DJ008", # Model does not define `__str__` method
8483
"DJ012", # Order of model's inner classes, methods, and fields does not follow the Django Style Guide: `Meta` class should come before `get_absolute_url`
8584
]

0 commit comments

Comments
 (0)