Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDavid c
Courses Plus Student 27,988 PointsDuplicate records
I don't want to be able to have a duplicate record for UPCs in my database. Finish the model below:
class Product(Model): name = CharField() description = TextField() upc = CharField(max_length=100, X =True)
In this question what would 'X' be?
2 Answers
Noah Olatoye
Front End Web Development Techdegree Graduate 23,869 PointsThe model should be: class Product(Model): name = CharField() description = TextField() upc = CharField(max_length=100, unique=True)
Steven Parker
231,269 PointsYour "X" would be the keyword name of the argument which when set to "True" enforces that there will be no duplicates.
Or were you asking for the actual answer?
David c
Courses Plus Student 27,988 PointsActual answer would probably help me more right now :D
Steven Parker
231,269 PointsOkay, the keyword name of the argument that prevents duplicates when set to "True" is "unique".