SHARE
TWEET

Untitled

a guest Feb 27th, 2020 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Am modelul
  2.  
  3. class ContractRequest(models.Model):
  4.     STATUS = (
  5.         ('Saved', 'Saved'),
  6.         ('Invited', 'Invited'),
  7.         ('Accepted', 'Accepted'),
  8.         ('Declined', 'Declined'),
  9.         ('Contract_Pending', 'Contract_Pending'),
  10.         ('Contract', 'Contract')
  11.     )
  12.  
  13.     sender = models.ForeignKey('profiles.Profile', on_delete=models.CASCADE)
  14.     post = models.ForeignKey('posts.Post', on_delete=models.CASCADE)
  15.     offer = models.ForeignKey('offers.Offer', on_delete=models.CASCADE)
  16.     status = models.CharField(choices=STATUS, max_length=16)
  17.  
  18. # Uite asa o chestie.. cu ajutorul field'ului `post` pot sa ajung la cel care a creat aceasta postare:
  19. #     post.pod.company.profile.user
  20. # Respectiv cu field'ul `offer` la fel:
  21. #     offer.factory.profile.user
  22. # Ca sa imi dau seama cine e `receiver`ul la request, trebuie sa verific:
  23. #     Daca `offer`ul ii apartine `sender`ului atunci `receiver`ul pot sa il iau din `post`, si asa invers..
  24. # Ca sa nu fac asta, sa adaug un field:
  25. #     receiver = models.ForeignKey('profiles.Profile', on_delete=models.CASCADE)
  26. # ? sau nu e nevoie de acest field in plus ?
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top