DateField format

3 views
Skip to first unread message

shocks

unread,
Jun 1, 2008, 8:26:20 AM6/1/08
to Django users
Hi

I'm using pluging into Django with a binary format based on SOAP (AMF)
into Flex. I'd like to format the date field as DD-MM-YY however the
date object returned from my Django gateway is of the format: Sun Jun
1 01:00:00 GMT+0100 2008. How do I go about changing this in the
model? My views are very simple and just return all models as objects
(I'm not doing any formatting in there).

class Blog(models.Model):
title = models.CharField('Title', maxlength=100)
date = models.DateField('Date')
copy = models.TextField('Copy')
image1 = models.FileField('Image 1', upload_to='uploads/
images/')
image2 = models.FileField('Image 2', upload_to='uploads/
images/', blank=True)
image3 = models.FileField('Image 3', upload_to='uploads/
images/', blank=True)
image4 = models.FileField('Image 4', upload_to='uploads/
images/', blank=True)
image5 = models.FileField('Image 5', upload_to='uploads/
images/', blank=True)
image6 = models.FileField('Image 6', upload_to='uploads/
images/', blank=True)
video = models.CharField('Video', maxlength=256, blank=True)

def __str__(self):
return self.title
class Meta:
verbose_name = "Blog"
verbose_name_plural = "Blogs"

class Admin:
list_display = ('title', 'date')



import django.http as http

from models import Blog

import models

def blog(http_request):
return models.Blog.objects.all()


Thanks

Ben
Reply all
Reply to author
Forward
0 new messages