def section_position var Sections objects count choice for in range ch

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