Browse Source

enhance readability beyond flake8

Gerrit 7 years ago
parent
commit
73dcaf05cf
1 changed files with 34 additions and 16 deletions
  1. 34
    16
      main/models.py

+ 34
- 16
main/models.py View File

22
 class Ticket(models.Model):
22
 class Ticket(models.Model):
23
 
23
 
24
     title = models.CharField('Title', max_length=255)
24
     title = models.CharField('Title', max_length=255)
25
-    owner = models.ForeignKey(User, related_name='owner', blank=True,
26
-                              null=True, verbose_name='Owner', )
25
+
26
+    owner = models.ForeignKey(User,
27
+                              related_name='owner',
28
+                              blank=True,
29
+                              null=True,
30
+                              verbose_name='Owner')
31
+
27
     description = models.TextField('Description', blank=True, null=True)
32
     description = models.TextField('Description', blank=True, null=True)
28
 
33
 
29
     STATUS_CHOICES = (
34
     STATUS_CHOICES = (
32
         ('WAITING', 'WAITING'),
37
         ('WAITING', 'WAITING'),
33
         ('DONE', 'DONE'),
38
         ('DONE', 'DONE'),
34
     )
39
     )
35
-    status = models.CharField('Status', choices=STATUS_CHOICES, max_length=255,
36
-                              blank=True, null=True)
37
-
38
-    waiting_for = models.ForeignKey(User, related_name='waiting_for',
39
-                                    blank=True, null=True,
40
-                                    verbose_name='Waiting For', )
40
+    status = models.CharField('Status',
41
+                              choices=STATUS_CHOICES,
42
+                              max_length=255,
43
+                              blank=True,
44
+                              null=True)
45
+
46
+    waiting_for = models.ForeignKey(User,
47
+                                    related_name='waiting_for',
48
+                                    blank=True,
49
+                                    null=True,
50
+                                    verbose_name='Waiting For')
41
 
51
 
42
     # set in view when status changed to "DONE"
52
     # set in view when status changed to "DONE"
43
     closed_date = models.DateTimeField(blank=True, null=True)
53
     closed_date = models.DateTimeField(blank=True, null=True)
46
                                     related_name='assigned_to',
56
                                     related_name='assigned_to',
47
                                     blank=True,
57
                                     blank=True,
48
                                     null=True,
58
                                     null=True,
49
-                                    verbose_name='Assigned to',)
59
+                                    verbose_name='Assigned to')
50
 
60
 
51
     created = models.DateTimeField(auto_now_add=True)
61
     created = models.DateTimeField(auto_now_add=True)
52
     updated = models.DateTimeField(auto_now=True)
62
     updated = models.DateTimeField(auto_now=True)
59
     """
69
     """
60
     A FollowUp is a comment to a ticket.
70
     A FollowUp is a comment to a ticket.
61
     """
71
     """
62
-    ticket = models.ForeignKey(Ticket, verbose_name='Ticket',)
72
+    ticket = models.ForeignKey(Ticket, verbose_name='Ticket')
63
     date = models.DateTimeField('Date', default=timezone.now)
73
     date = models.DateTimeField('Date', default=timezone.now)
64
     title = models.CharField('Title', max_length=200,)
74
     title = models.CharField('Title', max_length=200,)
65
     text = models.TextField('Text', blank=True, null=True,)
75
     text = models.TextField('Text', blank=True, null=True,)
66
-    user = models.ForeignKey(User, blank=True, null=True, verbose_name='User',)
76
+    user = models.ForeignKey(User, blank=True, null=True, verbose_name='User')
67
     created = models.DateTimeField(auto_now_add=True)
77
     created = models.DateTimeField(auto_now_add=True)
68
     modified = models.DateTimeField(auto_now=True)
78
     modified = models.DateTimeField(auto_now=True)
69
 
79
 
90
 
100
 
91
 
101
 
92
 class Attachment(models.Model):
102
 class Attachment(models.Model):
93
-    ticket = models.ForeignKey(Ticket, verbose_name='Ticket',)
94
-    file = models.FileField('File', upload_to=attachment_path,
95
-                            max_length=1000,)
96
-    filename = models.CharField('Filename', max_length=1000,)
97
-    user = models.ForeignKey(User, blank=True, null=True, verbose_name='User',)
103
+    ticket = models.ForeignKey(Ticket, verbose_name='Ticket')
104
+
105
+    file = models.FileField('File',
106
+                            upload_to=attachment_path,
107
+                            max_length=1000)
108
+
109
+    filename = models.CharField('Filename', max_length=1000)
110
+
111
+    user = models.ForeignKey(User,
112
+                             blank=True,
113
+                             null=True,
114
+                             verbose_name='User')
115
+
98
     created = models.DateTimeField(auto_now_add=True)
116
     created = models.DateTimeField(auto_now_add=True)
99
 
117
 
100
     def get_upload_to(self, field_attname):
118
     def get_upload_to(self, field_attname):

Loading…
Cancel
Save