Compare commits

..

1 Commits

Author SHA1 Message Date
pixeebot[bot]
748a542011 Ensure Django Model Classes Implement a __str__ Method 2025-05-29 03:42:06 +00:00
3 changed files with 11 additions and 1 deletions

View File

@@ -55,3 +55,8 @@ class PageView(models.Model):
return model_class.objects.filter(pk__in=id_list).order_by(preserved)
return model_class.objects.none()
def __str__(self):
model_name = self.__class__.__name__
fields_str = ", ".join((f"{field.name}={getattr(self, field.name)}" for field in self._meta.fields))
return f"{model_name}({fields_str})"

View File

@@ -66,6 +66,11 @@ class TrackedModel(models.Model):
).order_by('-pgh_created_at')
return self.__class__.objects.none()
def __str__(self):
model_name = self.__class__.__name__
fields_str = ", ".join((f"{field.name}={getattr(self, field.name)}" for field in self._meta.fields))
return f"{model_name}({fields_str})"
class HistoricalSlug(models.Model):
"""Track historical slugs for models"""
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)

View File

@@ -4,7 +4,7 @@ djangorestframework==3.15.2
django-cors-headers==4.7.0
# Authentication
django-allauth==65.8.0
django-allauth==65.4.1
django-oauth-toolkit==3.0.1
dj-rest-auth==7.0.1 # Added for REST authentication endpoints
pyjwt==2.10.1