Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Milad Rastian
committed
Aug 3, 2011
1 parent
92882bb
commit 8d035e2
Showing
6 changed files
with
122 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,30 @@ | ||
from django_jalali import forms | ||
from django_jalali import forms as jforms | ||
from django.utils.translation import ugettext as _ | ||
from django import forms | ||
from django.contrib.admin.widgets import AdminTimeWidget | ||
from django.utils.safestring import mark_safe | ||
|
||
import settings | ||
|
||
class AdminjDateWidget(forms.jDateInput): | ||
class AdminjDateWidget(jforms.jDateInput): | ||
class Media: | ||
js = (settings.ADMIN_MEDIA_PREFIX + "js/jcalendar.js", | ||
settings.ADMIN_MEDIA_PREFIX + "js/admin/jDateTimeShortcuts.js") | ||
def __init__(self, attrs={}, format=None): | ||
super(AdminjDateWidget, self).__init__(attrs={'class': 'vDateField', 'size': '10'}, format=format) | ||
super(AdminjDateWidget, self).__init__(attrs={'class': 'vjDateField', 'size': '10'}, format=format) | ||
|
||
|
||
#class AdminTimeWidget(forms.TimeInput): | ||
# class Media: | ||
# js = (settings.ADMIN_MEDIA_PREFIX + "js/calendar.js", | ||
# settings.ADMIN_MEDIA_PREFIX + "js/admin/DateTimeShortcuts.js") | ||
# | ||
# def __init__(self, attrs={}, format=None): | ||
# super(AdminTimeWidget, self).__init__(attrs={'class': 'vTimeField', 'size': '8'}, format=format) | ||
|
||
#class AdminSplitDateTime(forms.SplitDateTimeWidget): | ||
# """ | ||
# A SplitDateTime Widget that has some admin-specific styling. | ||
# """ | ||
# def __init__(self, attrs=None): | ||
# widgets = [AdminDateWidget, AdminTimeWidget] | ||
# # Note that we're calling MultiWidget, not SplitDateTimeWidget, because | ||
# # we want to define widgets. | ||
# forms.MultiWidget.__init__(self, widgets, attrs) | ||
# | ||
# def format_output(self, rendered_widgets): | ||
# return mark_safe(u'<p class="datetime">%s %s<br />%s %s</p>' % \ | ||
# (_('Date:'), rendered_widgets[0], _('Time:'), rendered_widgets[1])) | ||
class AdminSplitjDateTime(forms.SplitDateTimeWidget): | ||
""" | ||
A SplitDateTime Widget that has some admin-specific styling. | ||
""" | ||
def __init__(self, attrs=None): | ||
widgets = [AdminjDateWidget, AdminTimeWidget] | ||
# Note that we're calling MultiWidget, not SplitDateTimeWidget, because | ||
# we want to define widgets. | ||
forms.MultiWidget.__init__(self, widgets, attrs) | ||
|
||
def format_output(self, rendered_widgets): | ||
return mark_safe(u'<p class="datetime">%s %s<br />%s %s</p>' % \ | ||
(_('Date:'), rendered_widgets[0], _('Time:'), rendered_widgets[1])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters