kindly i need a help

10 views
Skip to first unread message

Richard Dushime

unread,
Jun 23, 2021, 12:04:25 PM6/23/21
to django...@googlegroups.com
i am making a website using  django  and postgresql the  when i made a migration and i created the tables then i i went  in the admin (django administration ) everything was okay  the user and the data i can add and manipulate all the data and get effect into the database  but  on my webpages i am not seeing anything it is deseapiring
 this is my index.html file
  <!-- ======= About Us Section ======= -->
    <section id="about" class="about">
      <div class="container">

        <div class="section-title" data-aos="fade-up">
          <h2>{{Abt.name}}</h2>
          <p>{{Abt.desc}}</p>
        </div>

        <div class="row">
          <div class="col-lg-6" data-aos="fade-right">
            <div class="image">
              <img src="{{Abt.img.url}}" class="img-fluid" alt="">
            </div>
          </div>
          <div class="col-lg-6" data-aos="fade-left">
            <div class="content pt-4 pt-lg-0 pl-0 pl-lg-3 ">
              <h3>{{Abt.title}}</h3>
              <p class="font-italic">
                {{Abt.desc2}}
              </p>
              <ul>
                <li><i class="bx bx-check-double"></i> Ullamco laboris nisi ut aliquip ex ea commodo consequat.</li>
                <li><i class="bx bx-check-double"></i> Duis aute irure dolor in reprehenderit in voluptate velit.</li>
                <li><i class="bx bx-check-double"></i> Ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate trideta storacalaperda mastiro dolore eu fugiat nulla pariatur.</li>
              </ul>
              <p>
                Ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
                velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
                culpa qui officia deserunt mollit anim id est laborum
              </p>
            </div>
          </div>
        </div>

      </div>
    </section><!-- End About Us Section -->

    <!-- ======= Services Section ======= -->
    <section id="services" class="services">
      <div class="container">
       
        <div class="section-title" data-aos="fade-up">
          <h2>{{service.title}}</h2>
          <p>{{service.description}}</p>
        </div>
       
        <div class="row">
          <div class="col-lg-6 order-2 order-lg-1">
            <div class="icon-box mt-5 mt-lg-0" data-aos="fade-up">
              <i class="bx bx-receipt"></i>
              <h4>{{service.name}}</h4>
              <p>{{service.description1}}</p>
            </div>
            
admin.py
models.py
views.py
urls.py
database table.PNG
admin page.PNG

Kelvin Sajere

unread,
Jun 23, 2021, 12:56:21 PM6/23/21
to django...@googlegroups.com
I see three errors in your views and templates. First, the kvc variable in your view holds a list of all objects in your Aboutus table and all objects in your Services table, and I don’t think that’s what you want. 

If I understand what you want to achieve, then your view should look like this.

def index(request):
    Abt = Aboutus.objects.all()
    service = Services.objects.all()
    kvc = {“Abt” : Abt,
                “service” : service}
    return render(request, "index.html", kvc)

Then in your template, loop over Abt to get all about us objects, then over services to get services objects. You can’t just call Abt or services cos they are lists of objects. 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJCm56LnoLUsxp-NSZuopNchdG7wAd5UOHxdyfjsfCR7RmMD3w%40mail.gmail.com.
--
KeLLs
Reply all
Reply to author
Forward
0 new messages