class Sections models Model def section_position self var Sections obj

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
class Sections(models.Model):
def section_position(self):
var = Sections.objects.count()
choice = []
for i in range(1,var+2):
choice.append((i,i))
return choice
name = models.CharField(max_length=30)
display_name = models.CharField(max_length=30)
path = models.CharField(max_length=50)
position = models.IntegerField(choices=self.section_position())