|
15 | 15 | from what_apps.utility.models import FixedObject
|
16 | 16 |
|
17 | 17 |
|
18 |
| - |
19 |
| - |
20 |
| - |
21 | 18 | class Communication(models.Model):
|
22 | 19 | '''
|
23 | 20 | A single instance of communication - a phone call, email, etc.
|
24 | 21 | '''
|
25 | 22 | created = models.DateTimeField(auto_now_add=True)
|
26 | 23 | description = models.TextField(blank=True, null=True)
|
27 | 24 |
|
| 25 | + |
28 | 26 | class CommunicationInvolvement(models.Model):
|
29 | 27 | '''
|
30 | 28 | People are involved in communication in different ways depending on the medium, the circumstances, and sometimes the actual people.
|
@@ -70,6 +68,7 @@ def summary(self):
|
70 | 68 | if self.direction == "from":
|
71 | 69 | return "%s called " % (self.person.userprofile.user.first_name)
|
72 | 70 |
|
| 71 | + |
73 | 72 | class PhoneCallQuerySet(QuerySet):
|
74 | 73 | def involving(self, user_list=None, include_from=True, include_to=True, subtractive=False):
|
75 | 74 | '''
|
@@ -112,6 +111,7 @@ def has_recording(self, voicemail=True):
|
112 | 111 | else:
|
113 | 112 | return calls_with_recordings.filter(tasks__tags__name="voicemail")
|
114 | 113 |
|
| 114 | + |
115 | 115 | class PhoneCall(Communication):
|
116 | 116 | '''
|
117 | 117 | This model is loosely based on a twilio phone call HTTP request, which is explained here:
|
@@ -277,6 +277,7 @@ def set_resolve_status(self, status, user):
|
277 | 277 | resolve_task = self.resolve_task()
|
278 | 278 | return status_is_changed
|
279 | 279 |
|
| 280 | + |
280 | 281 | class PhoneCallRecording(models.Model):
|
281 | 282 | '''
|
282 | 283 | Tracks the audio recording of a telephone call.
|
@@ -319,6 +320,7 @@ def message_count(self):
|
319 | 320 | count = self.number
|
320 | 321 | return count
|
321 | 322 |
|
| 323 | + |
322 | 324 | class PhoneCallEvent(object):
|
323 | 325 | '''
|
324 | 326 | Not a model.
|
@@ -348,13 +350,11 @@ def summary(self):
|
348 | 350 | summary = "caller hung up"
|
349 | 351 | return summary
|
350 | 352 |
|
351 |
| - |
352 |
| - |
353 |
| - |
354 | 353 | #TODO: Move this stuff elsewhere. Maybe the .save() method.
|
355 | 354 |
|
356 | 355 | RESOLVE_PHONE_CALL = "TaskPrototype__resolve_phone_call"
|
357 | 356 |
|
| 357 | + |
358 | 358 | def notifyCallSave(instance, **kwargs):
|
359 | 359 | '''
|
360 | 360 | When phone calls are saved, push to watch_calls
|
|
0 commit comments