Fork me on GitHub

Jan 21, 2007

Publicame: Templates y al proyecto se le ve cara :D

"Se le ve cara" es una expresión que quiere decir que el proyecto ya esta caminando :D, para esto tuve que tener un ejemplo... me dije: "Bueno estoy haciendo un site muy web 2.0 asi que llammoslo... "Web 2.0 news :D""

Las urls han cambiado, los modelos cambiaron, y por supuesto se añaden las templates.

Estructura del proyecto:

.
|-- __init__.py
|-- __init__.pyc
|-- db
| `-- publicame.db
|-- manage.py
|-- media
| |-- css
| | |-- html.css
| | |-- layout.css
| | `-- print.css
| `-- images
| |-- bg
| | |-- balloons.gif
| | |-- bullet.gif
| | |-- footer.jpg
| | |-- gradient.jpg
| | |-- header.jpg
| | |-- header_left.jpg
| | `-- header_right.jpg
| |-- firefox.jpg
| `-- icons
| |-- exclamation.gif
| |-- go.gif
| |-- quote.gif
| `-- stop.gif
|-- news
| |-- __init__.py
| |-- __init__.pyc
| |-- models.py
| |-- models.pyc
| |-- urls.py
| |-- urls.pyc
| |-- views.py
| `-- views.pyc
|-- settings.py
|-- settings.pyc
|-- templates
| |-- base.html
| |-- base_2col.html
| |-- comments
| | |-- free_preview.html
| | |-- freecomment_list.html
| | |-- freeform.html
| | `-- posted.html
| `-- news
| |-- article_archive.html
| `-- article_detail.html
|-- urls.py
`-- urls.pyc
Nuevas urls:

from django.conf.urls.defaults import *
from django.contrib.comments.feeds import LatestFreeCommentsFeed
from django.contrib.comments.models import FreeComment

comments_info_dict = {
'queryset': FreeComment.objects.all(),
'paginate_by': 15,
}

urlpatterns = patterns('',
# Index example
(r'^$', 'publicame.news.views.index'),

# Example:
(r'^news/', include('publicame.news.urls')),

# Uncomment this for admin:
(r'^admin/', include('django.contrib.admin.urls')),

# static media docs -- development
(r'^css/(.*.css)$', 'django.views.static.serve', {'document_root': 'media/css', 'show_indexes': False}),
(r'^images/(.*.jpeg|.*.jpg|.*.gif)$', 'django.views.static.serve', {'document_root': 'media/images', 'show_indexes': False}),
(r'^js/(.*.js)$', 'django.views.static.serve', {'document_root': 'media/js', 'show_indexes': False}),

# Comments
(r'^comments/$', 'django.views.generic.list_detail.object_list', comments_info_dict),
(r'^comments/', include('django.contrib.comments.urls.comments')),
)
Screenshot:

Usando el comments framework!!!

Gracias a fullahead por su template que esta genial!!!

Jan 17, 2007

Urlsconf y problemas con los models

La verdad esto es algo comun... hoy implemente las urlconf:

Admin:

from django.conf.urls.defaults import *

urlpatterns = patterns('',
# Example:
(r'^newspaper/', include('publicame.newspaper.urls')),

# Uncomment this for admin:
(r'^admin/', include('django.contrib.admin.urls')),
)

Newspaper app:

from django.conf.urls.defaults import *
from publicame.newspaper.models import Article

info_dict = {
'queryset': Article.objects.all(),
'date_field': 'pub_date',
}

urlpatterns = patterns('django.views.generic.date_based',
# Generic Views:
(r'^(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/(?P[-\w]+)/$', 'object_detail', dict(info_dict, slug_field='slug')),
(r'^(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/$', 'archive_day', info_dict),
(r'^(?P\d{4})/(?P[a-z]{3})/$', 'archive_month', info_dict),
(r'^(?P\d{4})/$', 'archive_year', info_dict),
(r'^/?$', 'archive_index', info_dict),
)

Usando generic_views genial ;)

Los newspaper.models actualizados:

from django.db import models

class Keyword (models.Model):
"""La palabra clave"""
name = models.CharField(unique=True, maxlength=25)
def __str__(self):
return self.name
class Admin:
pass

class Tag (models.Model):
"""Escribir doc string"""
name = models.CharField(unique=True, maxlength=25)
keywords = models.ManyToManyField(Keyword)
slug = models.SlugField(unique=True, maxlength=100, prepopulate_from=("name", ))
def __str__(self):
return self.name
class Admin:
pass

class Category (models.Model):
"""Escribir doc string"""
name = models.CharField(maxlength=50)
slug = models.SlugField(unique=True, maxlength=100, prepopulate_from=("name", ))
def __str__(self):
return self.name
class Admin:
pass

class Article (models.Model):
"""Escribir doc string"""
title = models.CharField(maxlength=150)
category = models.ForeignKey(Category, related_name='articles')
pub_date = models.DateTimeField()
precis = models.TextField()
content = models.TextField()
first_page = models.BooleanField()
slug = models.SlugField(unique=True, maxlength=225, prepopulate_from=("title", ))
def is_first_page(self):
return first_page
def __str__(self):
return self.title
class Admin:
pass

class Rank (models.Model):
"""Escribir doc string"""
value = models.PositiveIntegerField()
article = models.ForeignKey(Article)
def __str__(self):
return str(self.value)
class Admin:
pass

Mañana me dedicare a las templates

Jan 16, 2007

Publicame!!!

Publicame es un proyecto que estoy empezando el cual trata de una aplicación web para el manejo de un diario web, un periódico o una revista el cual estoy desarrollando en Django.

Bueno la idea es simple:

  1. Obtener una manera simple de agregar contenido... facil gracias a la AAI(Automagic Admin Interface) de Django
  2. Hacer busquedas utiles y faciles
  3. Ofrecer otros servicios... Vlogs, Blogs, Podcast, VideoStreamming, Calendars, Mapas, etc
  4. Mostrar los datos de diversas maneras... pdf, rss... etc
  5. No es otro sitio de noticias... ofrecera multimedia, entretenimiento, guias, recomendaciones... etc
Hasta ahora solo tengo el modelo en Django:

from django.db import models

class Keyword (models.Model):
"""La palabra clave"""
name = models.CharField(unique=True, maxlength=25)
def __str__(self):
return self.name
class Admin:
pass

class Tag (models.Model):
"""Escribir doc string"""
name = models.CharField(unique=True, maxlength=25)
keywords = models.ManyToManyField(Keyword)
slug = models.SlugField(unique=True, maxlength=100, prepopulate_from=("name", ))
def __str__(self):
return name
class Admin:
pass

class Category (models.Model):
"""Escribir doc string"""
name = models.CharField(maxlength=50)
slug = models.SlugField(unique=True, maxlength=100, prepopulate_from=("name", ))
def __str__(self):
return name
class Admin:
pass

class Article (models.Model):
"""Escribir doc string"""
title = models.CharField(maxlength=150)
category = models.ForeignKey(Category, related_name='articles')
date_time = models.DateTimeField()
precis = models.TextField()
content = models.TextField()
first_page = models.BooleanField()
slug = models.SlugField(unique=True, maxlength=225, prepopulate_from=("title", ))
def is_first_page(self):
return first_page
def __str__(self):
return title
class Admin:
pass

class Rank (models.Model):
"""Escribir doc string"""
value = models.PositiveIntegerField()
article = models.ForeignKey(Article)
def __str__(self):
return str(value)
class Admin:
pass

Como ven hay mucho trabajo por delante...

Mis metas:
  1. Ser mejor que http://www.elnuevodiario.com.ni/ que esta desarrollado en PHP por la gente de guegue
  2. Ser al menos un poco de lo genial que es este: http://www.ljworld.com/
Por cierto la licencia es BSD y sera presentado posiblemente a finales de febrero.

Django:

"The Web framework for perfectionist with deadlines"

Es exactamente lo que necesito!

Jan 9, 2007

Instalar MS Internet Explorer en Linux


[IE7, 6, 5.5, 5 en Linux]

Pues he logrado instalar MS Internet Explorer en Linux gracias a este proyecto: ies4linux el cual(mediante wine) te permite instalar IE en Linux en sus versiones 5.0, 5.5, 6.0 y 7.0... todas.

Pero cual es el motivo?

Como desarrollador web me permite verificar la portabilidad de mis aplicaciones en MS Internet Explorer lo cual es genial porque ya no necesito una maquina Windows.

[Descarga IEs4Linux]

Como ejecutarlo?... desde una consola pon los siguientes comandos en el lugar donde fue descargado:

tar xvvzf ies4linux-2.5beta4.tar.gz
cd ies4linux-2.5beta4
./ies4linux --beta-install-ie7

disclaimer



Things written in this blog are my personal thoughts or points of view, and do not represent at all the position of my employer.

Code in the website is licensed under The MIT License

Content of this blog is:
Creative Commons License
Licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.