Skip to content

Commit

Permalink
Merge pull request #661 from srahulbadami/Develop_20.05
Browse files Browse the repository at this point in the history
TimeZone Fixes
  • Loading branch information
souravbadami authored Jun 30, 2020
2 parents 66ab198 + 77a0be0 commit 72c4d27
Show file tree
Hide file tree
Showing 18 changed files with 3,776 additions and 130 deletions.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ djangorestframework = "*"
django_filter = "*"
cffi = "*"
django-mdeditor = "*"
django-bootstrap-datepicker-plus = "*"
django-tz-detect = "*"

[dev-packages]

Expand Down
34 changes: 17 additions & 17 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion bugheist/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
'rest_framework.authtoken',
'django_cron',
'mdeditor',
'bootstrap_datepicker_plus'
'bootstrap_datepicker_plus',
'tz_detect'
)

CRON_CLASSES = [
Expand All @@ -82,6 +83,7 @@
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'tz_detect.middleware.TimezoneMiddleware',
)

TESTING = len(sys.argv) > 1 and sys.argv[1] == 'test'
Expand Down
1 change: 1 addition & 0 deletions bugheist/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
url(r'^api/v1/issue/update/$', csrf_exempt(website.views.UpdateIssue)),
url(r'^api/v1/scoreboard/$', website.views.get_scoreboard),
url(r'^error/', website.views.throw_error, name='post_error'),
url(r'^tz_detect/', include('tz_detect.urls')),
]

if settings.DEBUG:
Expand Down
8 changes: 3 additions & 5 deletions website/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ class Meta:
model = UserProfile
fields = ('user_avatar',)

class HuntForm (forms.Form):
class HuntForm (forms.Form):
content = MDTextFormField ()

class DateTimeForm(forms.Form):
start_date = forms.DateTimeField(
widget=DateTimePickerInput())
start_date = forms.DateTimeField(widget=forms.DateTimeInput(attrs={'class': 'col-sm-6', 'readonly' : True}),label='', required=False )
end_date = forms.DateTimeField(widget=forms.DateTimeInput(attrs={'class': 'col-sm-6', 'readonly' : True}),label='', required=False)
1 change: 1 addition & 0 deletions website/static/css/mtr-datepicker.default-theme.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions website/static/css/mtr-datepicker.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions website/static/js/dt.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

var MtrDatepickerDemo = (function() {

var datepickers = [];
var exportSettings;

var init = function(config, settings) {
exportSettings = settings;
var datepicker = new MtrDatepicker(config);
datepickers.push(datepicker);

var exportFormatsContainer = document.getElementById(settings.exportFormats);
datepickerChange(exportFormatsContainer, datepicker,settings.exportFormats);

datepicker.onChange('all', function() {
datepickerChange(exportFormatsContainer, datepicker, settings.exportFormats);
});

return datepicker;
};

function datepickerChange(resultElement, datepicker, elemId) {
var result = datepicker.format('YYYY-MM-DD HH:mm');
console.log("HERE")
if(elemId=="datepicker-1-res"){
$("#id_start_date").val(result);
}
else if(elemId=="datepicker-2-res"){
$("#id_end_date").val(result);
}
resultElement.innerHTML = result;
}

return {
init: init
};

})();
Loading

0 comments on commit 72c4d27

Please sign in to comment.