I had a project where I needed to set the initial value to the current week's week ending date (Sat), so I needed a custom form too. I used the AdminDateWidget, but I think this will be the correct widget for your needs.
# import the widgets from django.contrib.admin import widgets # use the widget on this line date = forms.DateTimeField(widget=widgets.AdminSplitDateTime) keith On Thu, Oct 16, 2008 at 6:23 PM, mthorley <[EMAIL PROTECTED]> wrote: > > Hello, I'm building a custom admin site with a custom form and the > datetime widget shows up as a text input. When I set the widget for > the date field to textarea I get a textarea, but when I set it to > datetime, I get I text input. I also tried not specifying any widget > and I still get just a text input. > > Can some one please tell me why or how to fix it? > > Thanks much > -- > matthew > > from django import forms > from django.contrib import admin > from colorcode.trainertools.models import Workshop > > > class WorkshopForm(forms.Form): > name = forms.CharField(max_length=64) > date = forms.DateTimeField(widget=forms.DateTimeInput()) > code = forms.CharField() > > > class WorkshopAdmin(admin.ModelAdmin): > def get_form(self, request, obj=None, **kwargs): > return WorkshopForm > > > trainers_admin = admin.sites.AdminSite() > trainers_admin.register(Workshop, WorkshopAdmin) > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---