开发者

Django 1.2 DateField admin site problem

开发者 https://www.devze.com 2023-01-09 16:40 出处:网络
So, I\'m making a Django 1.2 app, and I\'m having a problem with the admin site.Here\'s the models.py:

So, I'm making a Django 1.2 app, and I'm having a problem with the admin site. Here's the models.py:

from django.db import models
from django.contrib.auth.models import User
import datetime

class Dailysales(models.Model):
    salesdate = models.DateField(primary_key=True)
    ...
def __unicode__(self):
    return self.salesdate.strftime("%B/%d/%Y")

My problem is that in the admin site, the salesdate field is showing up as a text input. I did as far as I can tell exactly the same thing with Django 1.1, and it gave me the datepicker widget. I don't know if it's related to 1.2 or I've just screwed something else up unintentionally, but I'm not sure what else to look开发者_如何学C at since all the documentation I can find says this should Just Work. If the model says it's a DateField, what else needs to happen to cause the admin site to show the datepicker? Any hints on where to investigate are appreciated.

0

精彩评论

暂无评论...
验证码 换一张
取 消