Created
August 23, 2013 19:03
-
-
Save ryazwinski/6322851 to your computer and use it in GitHub Desktop.
Django "invalid" model attributes?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TestModel(models.Model): | |
my_field = models.CharField(max_length=20) | |
tm = TestModel.objects.create(my_field='test') | |
tm.foo = 'bar' # how do I make this fail? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I expect I somehow need to override setattr but since setattr is used while building the object in the 1st place and when the object is being built it has no attributes... it presents a challenge.