I'm building an app in which users will be able to upload data for specific "sites", defined by the class below:
class Site(models.Model):
name = models.CharField(max_length=150)
code = models.CharField(max_length=10)
date_added = models.DateTimeField(default=timezone.now)
latitude = models.FloatField()
longitude = models.FloatField()
class Meta:
permissions = (
('upload_data', 'Upload Data'),
('download_data', 'Download Data')
)
Each Site will have "Data" objects associated with it, which users will need permission to create. For instance, 'User A' should only be able to upload data for 'Site A', and 'User B' to 'Site B'. How do I implement this into the Site model and on the User model side?
What I would like is a way from the admin panel to easily assign users to a site (or multiple sites).