File tree Expand file tree Collapse file tree 1 file changed +37
-3
lines changed Expand file tree Collapse file tree 1 file changed +37
-3
lines changed Original file line number Diff line number Diff line change 5
5
6
6
7
7
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
+
8
27
requester = models .OneToOneField (USER , on_delete = models .CASCADE )
9
28
sent_count = models .IntegerField ()
10
29
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.
13
33
14
- def __repr__ (self ):
34
+ Returns
35
+ -------
36
+ str
37
+ The username of the requester.
38
+ """
15
39
return str (self .requester .get_username ())
16
40
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 ())
You can’t perform that action at this time.
0 commit comments