Skip to content

Commit cd9e1a6

Browse files
committed
models code refactored
1 parent 8f5d8f0 commit cd9e1a6

File tree

1 file changed

+37
-3
lines changed

1 file changed

+37
-3
lines changed

verify_email/models.py

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,46 @@
55

66

77
class LinkCounter(models.Model):
8+
"""
9+
Represents a count of links sent by a user.
10+
11+
Attributes
12+
----------
13+
requester : OneToOneField
14+
A one-to-one relationship with the user who made the request.
15+
sent_count : int
16+
The total number of links sent by the requester.
17+
18+
Methods
19+
-------
20+
__str__() -> str:
21+
Returns the username of the requester as a string.
22+
23+
__repr__() -> str:
24+
Returns the username of the requester for representation.
25+
"""
26+
827
requester = models.OneToOneField(USER, on_delete=models.CASCADE)
928
sent_count = models.IntegerField()
1029

11-
def __str__(self):
12-
return str(self.requester.get_username())
30+
def __str__(self) -> str:
31+
"""
32+
Returns the username of the requester when converting the object to a string.
1333
14-
def __repr__(self):
34+
Returns
35+
-------
36+
str
37+
The username of the requester.
38+
"""
1539
return str(self.requester.get_username())
1640

41+
def __repr__(self) -> str:
42+
"""
43+
Returns a string representation of the LinkCounter instance.
44+
45+
Returns
46+
-------
47+
str
48+
The username of the requester.
49+
"""
50+
return str(self.requester.get_username())

0 commit comments

Comments
 (0)