I am having hard time to understand how to make field value unique while using Django MongoDB.my models.py has a model:
class Projects(models.Model):
projectName =models.CharField(max_length = 100,unique=True)
projectManager = EmbeddedModelField('Users')
Here i want whenever a new project instance is added it should have unique projectName.But this code is not working out as it allows adding same value for projectName and doesn’t give me error.I read its possible to make field value Unique by using indexes in pymongo but how do I do it in Django MongoDB.
Answer to my own question is I had to add unique=True for model field before doing syncdb.Thanks to culebron.Its working now