Re: kindly i need a help

2021-06-23 Thread Kelvin Sajere
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.

On Wed, Jun 23, 2021 at 17:04 Richard Dushime 
wrote:

> 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
>   
> 
>   
>
> 
>   {{Abt.name}}
>   {{Abt.desc}}
> 
>
> 
>   
> 
>   
> 
>   
>   
> 
>   {{Abt.title}}
>   
> {{Abt.desc2}}
>   
>   
> 
>  Ullamco laboris nisi ut aliquip ex ea commodo consequat.
> 
>  Duis aute irure dolor in reprehenderit in voluptate velit.
> 
>  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.
> 
>   
>   
>
> 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
>   
> 
>   
> 
>
>   
> 
>
> 
> 
>   
>
> 
>   {{service.title}}
>   {{service.description}}
> 
>
> 
>   
> 
>   
>   {{service.name}}
>   {{service.description1}}
> 
>
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJCm56LnoLUsxp-NSZuopNchdG7wAd5UOHxdyfjsfCR7RmMD3w%40mail.gmail.com
> 
> .
>
-- 
KeLLs

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADYqDX0MZiC3s0TqwPEFeJr9EgxttiaY9b%2BkgNbrPeaLjP0RVw%40mail.gmail.com.


kindly i need a help

2021-06-23 Thread Richard Dushime
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
  

  


  {{Abt.name}}
  {{Abt.desc}}



  

  

  
  

  {{Abt.title}}
  
{{Abt.desc2}}
  
  

 Ullamco laboris nisi ut aliquip ex ea commodo consequat.

 Duis aute irure dolor in reprehenderit in voluptate velit.

 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.

  
  
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
  

  


  




  


  {{service.title}}
  {{service.description}}



  

  
  {{service.name}}
  {{service.description1}}


-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJCm56LnoLUsxp-NSZuopNchdG7wAd5UOHxdyfjsfCR7RmMD3w%40mail.gmail.com.
from django.contrib import admin
from .models import Aboutus,Services

# Register your models here.
admin.site.register(Aboutus)
admin.site.register(Services)from os import name
from django.db import models

# Create your models here.

class Aboutus(models.Model):
name = models.CharField(max_length=100)
desc = models.TextField()
img = models.ImageField(upload_to='images')
title = models.CharField(max_length=200)
desc2 = models.TextField()

# services section
class Services(models.Model):
title = models.CharField(max_length=120)
description = models.TextField()
name = models.CharField(max_length=100)
description1 = models.TextField()from kampalavc.models import Aboutus, Services
from django.shortcuts import render

# Create your views here.

def index(request):

Abt = Aboutus.objects.all()
service = Services.objects.all()
kvc = [Abt,service]
return render(request, "index.html", {'kvc': kvc})from django.urls import path

from . import views

urlpatterns = [
path("", views.index, name="index")
]