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 trial

Python Using Databases in Python Gettin' CRUD-y With It Review: Using Databases in Python

Duplicate 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

Steven Parker
Steven Parker
231,269 Points

Your "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?

Actual answer would probably help me more right now :D

Steven Parker
Steven Parker
231,269 Points

Okay, the keyword name of the argument that prevents duplicates when set to "True" is "unique".