Ticket #27419: models.py

File models.py, 726 bytes (added by Louis-Dominique Dubeau, 8 years ago)
Line 
1from __future__ import unicode_literals
2
3from django.db import models
4
5class Foo(models.Model):
6
7 a = models.CharField(max_length=10)
8 b = models.CharField(max_length=10)
9 parent = models.ForeignKey(
10 "self", related_name="children", null=True, blank=True)
11
12class Bar(models.Model):
13
14 a = models.CharField(max_length=10)
15 _b = models.CharField(max_length=10, name="b", db_column="b")
16 parent = models.ForeignKey(
17 "self", related_name="children", null=True, blank=True)
18
19 @property
20 def b(self):
21 return self._b
22
23 @b.setter
24 def b(self, val):
25 print "SETTING B"
26 # This would make the problem disappear:
27 # self.__dict__["b"] = val
28 self._b = val
Back to Top