views:

34

answers:

1

Hi In Django application I have these models:

class DLL(models.Model):
prev = models.ForeignKey('self', related_name = 'prevItem', blank = True, null = True)
next = models.ForeignKey('self', related_name = 'nextItem', blank = True, null = True)

class Meta:
    abstract = True

class SomeData(DLL): name = models.TextField()

The problem is that when I save a SomeData object with next or prev set to another SomeData object, neither prev nor next is saved.

Example:

s1 = SomeData(name='one')
s2 = SomeData(name='two')
s2.save()
s1.next = s2
s1.save()

s = SomeData.objects.get(pk=2)
#now s is = s1
s.next
#is None
A: 

Sorry, this works perfectly well. Must have been some strange problem with the project. Solved.

QQQ