Hi,
Maybe g() should return the id instead of the instance? That does seem a
bit odd that it wouldn't accept an A() instance as the default.
Collin
On Wednesday, March 11, 2015 at 7:43:35 AM UTC-4, Krzysztof Ciebiera wrote:
>
> I have created a model A:
>
> def g():
> return A.objects.get(p
I have created a model A:
def g():
return A.objects.get(pk=1)
class A(models.Model):
a = models.IntegerField()
./manage.py makemigrations
./manage.py migrate
then I've added some data:
a = A(a=1)
a.save()
then I have created another model with a ForeignKey field with a default
set to
2 matches
Mail list logo