# Path: location/models.py
# class Location(models.Model):
# 	loc_id = models.AutoField(primary_key=True)
# 	city = models.CharField(max_length=30)
# 	state = models.CharField(max_length=30)
# 
# 	def __unicode__(self):
# 		return self.city + ', ' + self.state
# 	def __str__(self):
# 		return self.city + ', ' + self.state
# 
# Path: User/models.py
# class Farmer(models.Model):
# 	"""docstring for Farmer"""
# 	auto_id = models.AutoField(primary_key=True)
# 	name = models.CharField(max_length=30)
# 
# 	user_id = models.EmailField(max_length=30,unique=True)
# 	user_pwd = models.CharField(max_length=100)
# 
# 	contact = models.BigIntegerField()
# 	
# 	location = models.ForeignKey(Location, on_delete=models.CASCADE)
# 
# 	join_timestamp = models.DateTimeField(auto_now=False,auto_now_add=True)
# 	
# 	def __unicode__(self):
# 		return self.name
# 	def __str__(self):
# 		return self.name


from django.db import models
from location.models import Location
from User.models import Farmer

	ferti = models.ForeignKey(Fertilizer, on_delete=models.CASCADE, blank=True, null=True)
	nutrient = models.ForeignKey(Nutrient, on_delete=models.CASCADE, blank=True, null=True)

	def __unicode__(self):
		return self.ferti.name + ', ' + self.nutrient.name
	def __str__(self):
		return self.ferti.name + ', ' + self.nutrient.name

class CropNutrient(models.Model):
	"""docstring for CropNutrient"""
	class Meta:
		unique_together = (('crop', 'nutrient'),)

	crop = models.ForeignKey(Crop, on_delete=models.CASCADE, blank=True, null=True)
	nutrient = models.ForeignKey(Nutrient, on_delete=models.CASCADE, blank=True, null=True)

	def __unicode__(self):
		return self.crop.name + ', ' + self.nutrient.name
	def __str__(self):
		return self.crop.name + ', ' + self.nutrient.name


class CropFarmer(models.Model):
	"""docstring for CropFarmer"""
	class Meta:
		unique_together = (('crop', 'disease', 'farmer'),)

	crop = models.ForeignKey(Crop, on_delete=models.CASCADE, blank=True, null=True)
	disease = models.ForeignKey(Disease, on_delete=models.CASCADE, blank=True, null=True)

# Path: location/models.py
# class Location(models.Model):
# 	loc_id = models.AutoField(primary_key=True)
# 	city = models.CharField(max_length=30)
# 	state = models.CharField(max_length=30)
# 
# 	def __unicode__(self):
# 		return self.city + ', ' + self.state
# 	def __str__(self):
# 		return self.city + ', ' + self.state
# 
# Path: User/models.py
# class Farmer(models.Model):
# 	"""docstring for Farmer"""
# 	auto_id = models.AutoField(primary_key=True)
# 	name = models.CharField(max_length=30)
# 
# 	user_id = models.EmailField(max_length=30,unique=True)
# 	user_pwd = models.CharField(max_length=100)
# 
# 	contact = models.BigIntegerField()
# 	
# 	location = models.ForeignKey(Location, on_delete=models.CASCADE)
# 
# 	join_timestamp = models.DateTimeField(auto_now=False,auto_now_add=True)
# 	
# 	def __unicode__(self):
# 		return self.name
# 	def __str__(self):
# 		return self.name


# Path: crop/models.py
from django.db import models
from location.models import Location
from User.models import Farmer


	ferti = models.ForeignKey(Fertilizer, on_delete=models.CASCADE, blank=True, null=True)
	nutrient = models.ForeignKey(Nutrient, on_delete=models.CASCADE, blank=True, null=True)

	def __unicode__(self):
		return self.ferti.name + ', ' + self.nutrient.name
	def __str__(self):
		return self.ferti.name + ', ' + self.nutrient.name

class CropNutrient(models.Model):
	"""docstring for CropNutrient"""
	class Meta:
		unique_together = (('crop', 'nutrient'),)

	crop = models.ForeignKey(Crop, on_delete=models.CASCADE, blank=True, null=True)
	nutrient = models.ForeignKey(Nutrient, on_delete=models.CASCADE, blank=True, null=True)

	def __unicode__(self):
		return self.crop.name + ', ' + self.nutrient.name
	def __str__(self):
		return self.crop.name + ', ' + self.nutrient.name


class CropFarmer(models.Model):
	"""docstring for CropFarmer"""
	class Meta:
		unique_together = (('crop', 'disease', 'farmer'),)

	crop = models.ForeignKey(Crop, on_delete=models.CASCADE, blank=True, null=True)
	disease = models.ForeignKey(Disease, on_delete=models.CASCADE, blank=True, null=True)

	farmer = models.ForeignKey(Farmer, on_delete=models.CASCADE, blank=True, null=True)