Skip to content

Commit ff13d04

Browse files
Bump Package Versions (#42)
* Ensure Django Model Classes Implement a `__str__` Method * This commit removes unnecessary dependencies from the requirements file and updates the versions of Python package dependencies. - Remove unnecessary dependencies from requirements file - Streamline project - Improve performance - Update versions of Python package dependencies - Ensure compatibility - Optimize performance --------- Co-authored-by: pixeebot[bot] <104101892+pixeebot[bot]@users.noreply.github.com>
1 parent a045ff9 commit ff13d04

File tree

3 files changed

+9
-56
lines changed

3 files changed

+9
-56
lines changed

Pipfile.lock

Lines changed: 0 additions & 50 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apidemo/test_app/models.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ class Department(models.Model):
77
title = models.CharField(max_length=100)
88

99
def __str__(self) -> str:
10-
return f"{self.title}"
10+
model_name = self.__class__.__name__
11+
fields_str = ", ".join((f"{field.name}={getattr(self, field.name)}" for field in self._meta.fields))
12+
return f"{model_name}({fields_str})"
1113

1214
# The Employee class represents an employee with attributes such as first name, last name, department,
1315
# and birthdate.
@@ -18,4 +20,6 @@ class Employee(models.Model):
1820
birthdate = models.DateField(null=True, blank=True)
1921

2022
def __str__(self) -> str:
21-
return f"{self.first_name} {self.last_name}"
23+
model_name = self.__class__.__name__
24+
fields_str = ", ".join((f"{field.name}={getattr(self, field.name)}" for field in self._meta.fields))
25+
return f"{model_name}({fields_str})"

requirement.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@ click==8.1.7; python_version >= '3.7'
55
colorama==0.4.6; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6'
66
django==5.0.4; python_version >= '3.10'
77
django-ninja==1.1.0; python_version >= '3.7'
8-
granian==1.2.3; python_version >= '3.8'
8+
granian==1.3.0; python_version >= '3.8'
99
orjson==3.10.1; python_version >= '3.8'
10-
packaging==23.2; python_version >= '3.7'
10+
packaging==24.0; python_version >= '3.7'
1111
pltable==1.1.0
1212
pydantic==2.5.3; python_version >= '3.7'
1313
pydantic-core==2.14.6; python_version >= '3.7'
1414
python-dotenv==1.0.1; python_version >= '3.8'
15-
sqlparse==0.4.4; python_version >= '3.5'
16-
typer==0.11.1; python_version >= '3.7'
15+
sqlparse==0.5.0; python_version >= '3.8'
1716
typing-extensions==4.9.0; python_version >= '3.8'
1817
tzdata==2024.1; python_version >= '2'

0 commit comments

Comments
 (0)