Skip to content

Commit 06993df

Browse files
committed
remove broken locale work around
1 parent 33c9545 commit 06993df

File tree

10 files changed

+11
-282
lines changed

10 files changed

+11
-282
lines changed

README.md

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ bootstrap-datepicker.js multiple times can cause unexpected behavior.
1111

1212
Install
1313

14-
* Run `pip install django-bootstrap3-datetimepicker`
14+
* Run `pip git+https://github.com/samuelcolvin/django-bootstrap3-datetimepicker.git@<CHOOSE SHA HERE>#egg=django-bootstrap3-datetimepicker==2.4`
1515
* Add `'bootstrap3_datetime'` to your `INSTALLED_APPS`
1616

1717

@@ -50,34 +50,11 @@ because it will be set the current language of the thread automatically.
5050
<!DOCTYPE html>
5151
<html>
5252
<head>
53-
<link rel="stylesheet"
54-
href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.css">
55-
<link rel="stylesheet"
56-
href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.css">
57-
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.js">
58-
</script>
59-
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.js">
60-
</script>
61-
{{ form.media }}
53+
<!-- load all required js/css yourself here -->
6254
</head>
6355
<body>
6456
<form method="post" role="form">
65-
{% for field in form.visible_fields %}
66-
<div id="div_{{ field.html_name }}"
67-
class="form-group{% if field.errors %} has-error{% endif %}">
68-
{{ field.label_tag }}
69-
{{ field }}
70-
<div class="text-muted pull-right">
71-
<small>{{ field.help_text }}</small>
72-
</div>
73-
<div class="help-block">
74-
{{ field.errors }}
75-
</div>
76-
</div>
77-
{% endfor %}
78-
{% for hidden in form.hidden_fields %}
79-
{{ hidden }}
80-
{% endfor %}
57+
{{ form|bootstrap }}
8158
{% csrf_token %}
8259
<div class="form-group">
8360
<input type="submit" value="Submit" class="btn btn-primary" />
@@ -87,13 +64,15 @@ because it will be set the current language of the thread automatically.
8764
</html>
8865
```
8966

90-
Bootstrap3 and jQuery have to be included along with `{{ form.media }}`
67+
Here we assume you're using [django-bootstrap-form](https://github.com/tzangms/django-bootstrap-form) or
68+
[django-jinja-bootstrap-form](https://github.com/samuelcolvin/django-jinja-bootstrap-form) but you can
69+
draw out your HTML manually.
9170

92-
Requirements
93-
-------------------------------
71+
## Requirements
9472

9573
* Python >= 2.7
9674
* Django >= 1.8
97-
* Bootstrap >= 3.0
98-
75+
* Bootstrap == 3.X
76+
* Moment >= 2.10.6
77+
* bootstrap-datetimepicker >= 4.15.35
9978

bootstrap3_datetime/widgets.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
from django.forms.utils import flatatt
55
from django.forms.widgets import DateTimeInput
6-
from django.utils import translation
76
from django.utils.safestring import mark_safe
87
from django.utils.html import conditional_escape
98
from django.utils.encoding import force_text
@@ -51,7 +50,6 @@ def conv_datetime_format_js2py(cls, format):
5150
js_template = """
5251
<script>
5352
$(function(){
54-
moment.locale("%(language)s");
5553
$("#%(picker_id)s:has(input:not([readonly],[disabled]))").datetimepicker(%(options)s);
5654
});
5755
</script>"""
@@ -95,12 +93,7 @@ def render(self, name, value, attrs=None):
9593
input_attrs=flatatt(input_attrs),
9694
icon_attrs=flatatt(icon_attrs))
9795
if self.options:
98-
self.options['locale'] = translation.get_language()
99-
js = self.js_template % dict(
100-
language=translation.get_language(),
101-
picker_id=picker_id,
102-
options=json.dumps(self.options or {})
103-
)
96+
js = self.js_template % dict(picker_id=picker_id, options=json.dumps(self.options or {}))
10497
else:
10598
js = ''
10699
return mark_safe(force_text(html + js))

sample/__init__.py

Whitespace-only changes.

sample/manage.py

Lines changed: 0 additions & 14 deletions
This file was deleted.

sample/settings.py

Lines changed: 0 additions & 148 deletions
This file was deleted.

sample/todo_app/__init__.py

Whitespace-only changes.

sample/todo_app/forms.py

Lines changed: 0 additions & 15 deletions
This file was deleted.

sample/todo_app/templates/todo_app/template.html

Lines changed: 0 additions & 45 deletions
This file was deleted.

sample/todo_app/views.py

Lines changed: 0 additions & 12 deletions
This file was deleted.

sample/urls.py

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)