Browse Source

enhance readability beyond flake8

Gerrit 2 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,8 +22,13 @@ User.__unicode__ = user_unicode
22 22
 class Ticket(models.Model):
23 23
 
24 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 32
     description = models.TextField('Description', blank=True, null=True)
28 33
 
29 34
     STATUS_CHOICES = (
@@ -32,12 +37,17 @@ class Ticket(models.Model):
32 37
         ('WAITING', 'WAITING'),
33 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 52
     # set in view when status changed to "DONE"
43 53
     closed_date = models.DateTimeField(blank=True, null=True)
@@ -46,7 +56,7 @@ class Ticket(models.Model):
46 56
                                     related_name='assigned_to',
47 57
                                     blank=True,
48 58
                                     null=True,
49
-                                    verbose_name='Assigned to',)
59
+                                    verbose_name='Assigned to')
50 60
 
51 61
     created = models.DateTimeField(auto_now_add=True)
52 62
     updated = models.DateTimeField(auto_now=True)
@@ -59,11 +69,11 @@ class FollowUp(models.Model):
59 69
     """
60 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 73
     date = models.DateTimeField('Date', default=timezone.now)
64 74
     title = models.CharField('Title', max_length=200,)
65 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 77
     created = models.DateTimeField(auto_now_add=True)
68 78
     modified = models.DateTimeField(auto_now=True)
69 79
 
@@ -90,11 +100,19 @@ def attachment_path(instance, filename):
90 100
 
91 101
 
92 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 116
     created = models.DateTimeField(auto_now_add=True)
99 117
 
100 118
     def get_upload_to(self, field_attname):

Loading…
Cancel
Save