Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. user_identity = request.POST.get('user_id')
  2. contact_list = Contact.objects.filter(receiver_id = user_identity).order_by('-last_updated')
  3. contact_list_senders = contact_list.values_list('sender_id', flat=True)
  4. customer_list = Customer.objects.filter(customer_id__in=contact_list_senders)
  5. zipped_data = zip(contact_list, customer_list)
  6.  
  7. class Contact(models.Model):
  8. contact_id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
  9. related_complete_order = models.ForeignKey(landingpages.models.CompleteOrderList)
  10. receiver_id = models.CharField(max_length=244, blank=False, null=False)
  11. sender_id = models.CharField(max_length=244, blank=False, null=False)
  12. last_updated = models.DateTimeField()
  13. created = models.DateTimeField(auto_now_add=True)
  14.  
  15. class Customer(models.Model):
  16. customer_id = models.CharField(max_length=244, blank=False, null=False)
  17. first_name = models.CharField(max_length=244, blank=True, null=True)
  18. last_name = models.CharField(max_length=244, blank=True, null=True)
  19. email = models.CharField(max_length=244, blank=False, null=False)
  20. enrollment_method = models.CharField(max_length=244, blank=True, null=False)
  21. account_balance = models.DecimalField(default=0000.00, max_digits=6, decimal_places=2)
  22. reserved_balance = models.DecimalField(default=0000.00, max_digits=6, decimal_places=2)
  23. modified = models.DateTimeField(auto_now_add=True)
  24. created = models.DateTimeField(auto_now_add=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement