Guest User

Untitled

a guest
Jul 22nd, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. posd = models.ManyToManyField(Posd, through='Posd', through_fields=('hg','pos')) # This is wrong, doesn't work
  2.  
  3. class Posd(models.Model):
  4. #This class is just repsresenting the cost position in KBSUMME
  5. hg = models.IntegerField()
  6. pos = models.IntegerField()
  7. description = models.CharField(max_length=200)
  8. hours = models.CharField(max_length=5)
  9. cost = models.CharField(max_length=5)
  10.  
  11. class Meta:
  12. unique_together = (('hg', 'pos'),)
  13.  
  14. class KbMeta(models.Model):
  15. #This class is representing the meta data for one project. One row per project only.
  16. pid = models.IntegerField(primary_key=True)
  17. klaversion = models.CharField(max_length=50, blank=True)
  18. calcbase = models.CharField(max_length=10, blank=True)
  19. contractbase = models.CharField(max_length=10, blank=True)
  20. quotno = models.CharField(max_length=50)
  21. filename = models.CharField(max_length=100)
  22. datecalc = models.DateField(default='1999-09-09')
  23. dateupload = models.DateTimeField(default='1999-09-09')
  24. projname = models.CharField(max_length=100, blank=True)
  25. customer = models.CharField(max_length=100, blank=True)
  26. endcustomer = models.CharField(max_length=100, blank=True)
  27. phase = models.CharField(max_length=50, blank=True)
  28.  
  29. class Tdb(models.Model):
  30. #This is the T detail cost calculation
  31. hg = models.IntegerField()
  32. pos = models.IntegerField()
  33. hours = models.FloatField()
  34. cost = models.FloatField()
  35. kbmeta = models.ForeignKey(KbMeta, on_delete=models.CASCADE)
  36. posd = models.ManyToManyField(Posd, through='Posd', through_fields=('hg','pos')) # This is wrong, doesn't work
Add Comment
Please, Sign In to add comment