Guest User

Untitled

a guest
Oct 22nd, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. class Line(PartBaseModel):
  2. line_id = models.IntegerField()
  3. radio_towers_number = models.IntegerField(blank=True)
  4. control_station_numbers = models.IntegerField(blank=True)
  5. railway_department = models.CharField(max_length=100)
  6. railway_carto_geo_center = models.CharField(max_length=100)
  7. status_type = models.SmallIntegerField(choices=[(i.value, i.name) for i in EngineerStatusChoice])
  8. radio_object_connection_length = models.FloatField()
  9. control_station_connection_length = models.FloatField()
  10. project = models.ForeignKey(Project, related_name='lines', on_delete=models.CASCADE)
  11. workers = models.ManyToManyField(User, through='Role')
  12.  
  13.  
  14. class Role(models.Model):
  15. line = models.ForeignKey(Line, on_delete=models.CASCADE)
  16. user = models.ForeignKey(User, on_delete=models.CASCADE)
  17. role = models.SmallIntegerField(choices=[(i.value, i.name) for i in UserRoleChoice])
  18.  
  19. class Meta:
  20. unique_together = ('line', 'user', 'role')
Advertisement
Add Comment
Please, Sign In to add comment