'how fix cycle in django?

I have problem with cycle in djano(Maybe I dont understand this).I have cycle in template and it must to output value from database,but Idk how I can create cycle,which may output value from (id = 1),because this cycle output value (id = 0) again and again.

vds.html

{% for item in allobjects %}



  <div class="container-fluid">
        <div class="body2">
      <li class="title">{{item.title}}</li>
      <li class="listram">{{item.ram}}<small>ГБ(озу)</small></li>
      <img class="ram2"width="51px" height="49px" src="/static/main/images/ram.png" ></img>
      <li class="cpu">{{item.cpu}} vCore</li>
      <img class="cpu1"width="51px" height="50px"  src="/static/main/images/cpu.png" ></img>
     <li class="hdd">{{item.hdd}}<small> ГБ(ssd)</small></li>
     <img class="hdd1"width="51px" height="50px" src="/static/main/images/hdd.png" ></img>
     <li class="os">Установка любой ос</li>
     <img  class="os1 " width="47px" height="49px"src="/static/main/images/os.png"/>
     <li class="os">Виртуализация KVM</li>
     <img  class="os1 " width="47px" height="49px"src="/static/main/images/vds.png"/>
     <form action="https://billing.king-host.ru">
         <button type="submit" name="buy">Купить</button>
         </form>
     <li class= "prise">{{item.name}}₽/месяц</li>
  </div>
  </div>


  <div class="container-fluid">
        <div class="body3">
      <li class="title">{{item.title}}</li>
      <li class="listram"><small>ГБ(озу)</small></li>
      <img class="ram2"width="51px" height="49px" src="/static/main/images/ram.png" ></img>
      <li class="cpu">2 vCore</li>
      <img class="cpu1"width="51px" height="50px"  src="/static/main/images/cpu.png" ></img>
     <li class="hdd">40<small> ГБ(ssd)</small></li>
     <img class="hdd1"width="51px" height="50px" src="/static/main/images/hdd.png" ></img>
     <li class="os">Установка любой ос</li>
     <img  class="os1 " width="47px" height="49px"src="/static/main/images/os.png"/>
     <li class="os">Виртуализация KVM</li>
     <img  class="os1 " width="47px" height="49px"src="/static/main/images/vds.png"/>
     <form action="https://billing.king-host.ru">
         <button type="submit" name="buy">Купить</button>
         </form>
     <li class= "prise">600 ₽/месяц</li>
  </div>
  </div>
{% endfor %}

models.py

class VDSTARIFS( models.Model):
    id = models.CharField(max_length=40, primary_key= True,serialize=True)
    name = models.CharField(max_length=20, verbose_name = 'Цены')
    choosen = models.CharField(max_length= 20, choices = CHOOSE, verbose_name = 'Тариф', help_text='Выбор тарифного плана.')
    title = models.CharField(max_length= 15)
    ram = models.CharField(max_length=10)
    hdd = models.CharField(max_length= 10)
    cpu = models.CharField(max_length=10)
   
    def __str__(self):
        return str(self.title)

views.py

def vds(request):
    servers = VDSTARIFS.objects.all() ##Maybe filter 
    context1 = {
        'allobjects': servers
    }
    return render(request,'vds.html',context1)


Solution 1:[1]

I solved my problem, problem was because of wrong request.If someone will have this problem, solving this problem was used slices

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 MihailCapone