Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/04/2012, 15:18
ILuzbel
 
Fecha de Ingreso: septiembre-2011
Mensajes: 106
Antigüedad: 12 años, 7 meses
Puntos: 19
seleccionar datos de postgres

Hola a todos, bien pase a linux ubuntu y logre hacer funcionar todo , ahora quisiera hacer un select para imprimir las noticias en una hoja html .

He creado esta tabla:

Código PYTHON:
Ver original
  1. # Create your models here.
  2. class Posts(models.Model):
  3.     titulo = models.CharField(max_length=180)
  4.     seo = models.CharField(max_length=250)
  5.     post = models.TextField()
  6.     data = models.DateField()

Código SQL:
Ver original
  1. CREATE TABLE musicdb_posts
  2. (
  3.   id serial NOT NULL,
  4.   titulo CHARACTER VARYING(180) NOT NULL,
  5.   seo CHARACTER VARYING(250) NOT NULL,
  6.   post text NOT NULL,
  7.   DATA DATE NOT NULL,
  8.   CONSTRAINT musicdb_posts_pkey PRIMARY KEY (id )
  9. )

en views.py tengo esto:
Código PYTHON:
Ver original
  1. # Create your views here.
  2. from django.shortcuts import render_to_response
  3. from django.template.context import RequestContext
  4.  
  5. def ver_inicio(request):
  6.     return render_to_response('base.html', { 'page': 'Inicio',})

y en base.html tengo esto:

Código HTML:
Ver original
  1. <div id="content">
  2.     <h1><!-- Aqui el titulo --></h1>
  3.     <!-- Aqui el contenido del post -->
  4. </div>

Ahora alguien sabe como puedo hacer un select para imprimir en la pagina html las noticias?
Si es posible me podrían decir como puedo agregarle paginación?

Saludos...