Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery datepicker in Django admin without using django forms
    primarykey
    data
    text
    <p>I have a datefield named <code>pub_date</code> in my django project. I want to use jQuery datepicker instead of default django datepicker <strong>in django admin</strong>. But I want to do it <strong>without using django forms</strong>. Is it possible to do that? I'm giving my code below.</p> <p><strong>models.py</strong></p> <pre><code> import datetime from django.db import models class Poll(models.Model): question = models.CharField(max_length=200) date = models.DateField('Registration Date') pub_date = models.DateTimeField('date published') def __unicode__(self): return self.question def was_published_today(self): return self.pub_date.date() == datetime.date.today() was_published_today.short_description = 'Published today?' class Choice(models.Model): poll = models.ForeignKey(Poll) choice = models.CharField(max_length=200) votes = models.IntegerField() def __unicode__(self): return self.choice </code></pre> <p><strong>admin.py</strong></p> <pre><code> from django.contrib import admin from poject.app.models import Poll, Choice class ChoiceInline(admin.TabularInline): model = Choice extra = 3 class PollAdmin(admin.ModelAdmin): fieldsets = [ (None, {'fields': ['question']}), ('Date information', {'fields': ['pub_date'], 'classes': ['collapse']}), ] inlines = [ChoiceInline] list_display = ('question', 'pub_date', 'was_published_today') list_filter = ['pub_date'] search_fields = ['question'] date_hierarchy = 'pub_date' admin.site.register(Poll, PollAdmin) admin.site.register(Choice) </code></pre> <p>Is it possible to use <strong>jquery datepicker</strong> in the <strong>DateField</strong> and <strong>DateTimeField</strong> defined in the above models without using django forms?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload