[Answer]-In django(1.5.4) model form how do i get the admin type date and time selector?

1👍

Try with:

from django import form
from awesomite.models import tasks
from django.contrib.admin import widgets

class todoform(forms.ModelForm):

    title = forms.CharField(max_length=250, help_text="Please enter a title")
    description = forms.CharField(max_length=400, help_text="Please enter title description")
    time = forms.DateTimeField(widget=widgets.AdminSplitDateTime())

    class Meta:
        model = tasks
        fields = ('title','description','time')

You should include other Media files in your form->Media class or directly in template

(see -> Using Django time/date widgets in custom form)

Leave a comment