2
The error simply means that it is not iterable. Try to define it like this
For example
class Meta:
constraints = [models.UniqueConstraint(fields['app_uuid', 'version_code'], name='unique appversion')]
5
You need to assign iterable to the constraints. You are missing ,
in (models.UniqueConstraint(...),)
, which means you are assigning models.UniqueConstraint
instance instead of tuple.
class Meta:
constraints = (models.UniqueConstraint(fields=['student', 'classroom', 'code'], name='student_classroom_code'),)
- [Django]-Is there any way to get the default domain of Client() in unittest of Django?
- [Django]-Django multiple forms with formsets
- [Django]-My virtual environment is having access to global packages
0
Python tuples need at least one ,
before closing. If you dont specify this ,
, the interpreter take it for a group and the type will be the var inside the parenthesis
Example:
t = ('i am a tuple',) # this is good
t = ('i am not a tuple') # this is bad
- [Django]-Include a form for a related object in a modelform in Django
- [Django]-Django Multi-Table-Inheritance and Left Outer Joins
- [Django]-Django admin shows models name with extra "s" at the end
- [Django]-Validation Error with Multiple File Uploads in Django via Ajax
- [Django]-Django step through the code
Source:stackexchange.com