Commit 48234385 authored by fred's avatar fred

edit: add a (bootstrap based, <sigh/>) widget for datetime selection

parent 1dcea6d3
......@@ -14,11 +14,23 @@ from django.conf import settings
from django.template.loader import render_to_string
from taggit.forms import TagWidget
import datetimewidget.widgets
from .models import Emission, Episode, Diffusion, Schedule, SoundFile
DATETIME_OPTIONS = {
'format': 'dd/mm/yyyy hh:ii',
'language': 'fr',
'weekStart': '1',
'autoclose': 'true',
}
class DateTimeWidget(datetimewidget.widgets.DateTimeWidget):
def __init__(self, *args, **kwargs):
super(DateTimeWidget, self).__init__(*args, options=DATETIME_OPTIONS, **kwargs)
def slugify(s):
s = unicodedata.normalize('NFKD', s).encode('ascii', 'ignore').lower()
return re.sub(r'\W+', '-', s)
......@@ -145,7 +157,8 @@ class EpisodeForm(forms.ModelForm):
class EpisodeNewForm(EpisodeForm):
diffusion = forms.DateTimeField()
diffusion = forms.DateTimeField(label='First Diffusion',
widget=DateTimeWidget)
def save(self, commit=True):
episode = super(EpisodeNewForm, self).save(commit=commit)
......@@ -179,4 +192,5 @@ class DiffusionForm(forms.ModelForm):
model = Diffusion
widgets = {
'episode': forms.HiddenInput(),
'datetime': DateTimeWidget(),
}
......@@ -5,13 +5,18 @@
</script>
{% endblock %}
{% block content %}
{% block appbar %}
{% if episode.id %}
<h2>Épisode de « {{ episode.emission.title }} »</h2>
<h2>{{ episode.emission.title }} — {{ episode.title }}</h2>
<span><a href="../">Retourner à l'épisode</a></span>
{% else %}
<h2>Nouvel épisode de « {{ emission.title }} »</h2>
<h2>{{ emission.title }} — Nouvel épisode</h2>
<span><a href="./">Retourner à l'émission</a></span>
{% endif %}
{% endblock %}
{% block content %}
<form method="post">
<div id="form-content">
......
......@@ -127,6 +127,9 @@ INSTALLED_APPS = (
'ckeditor',
'haystack',
'taggit',
'jquery',
'datetimewidget',
'django_bootstrap_staticfiles',
'panikdb.emissions',
'panikdb.aa',
)
......
......@@ -10,14 +10,22 @@
font-style: normal;
}
html, body {
html {
margin: 0;
background: #F9F9F7 url(../images/a1.gif) repeat-x;
}
/* bootstrap <sigh/> */
h1, h2, h3, h4 {
font-family: sans-serif;
}
html {
background: #F9F9F7 url(../images/a1.gif) repeat-x;
body {
margin: 0;
background: transparent;
color: #8c8c73;
line-height: inherit;
font-size: 14px;
}
a {
......@@ -161,6 +169,7 @@ div#content h2 {
div#content ul {
line-height: 1.5em;
padding: 1ex 2ex 1ex 3ex;
}
#footer
......@@ -364,12 +373,18 @@ a.big-friendly-button {
background: #4690d6;
border: 1px solid #2a567f;
font-weight: bold;
border-radius: 5px;
}
a.big-friendly-button:hover {
background: #2a567f;
}
.input-append {
margin-left: 10px;
margin-bottom: 10px;
}
[class^="icon-"]:before, [class*=" icon-"]:before {
font-family: FontAwesome;
font-weight: normal;
......@@ -393,3 +408,4 @@ a [class^="icon-"], a [class*=" icon-"] {
.icon-circle-arrow-left:before { content: "\f0a8"; }
.icon-circle-arrow-right:before { content: "\f0a9"; }
.icon-music:before { content: "\f001"; }
.icon-th:before { content: "\f00a"; }
......@@ -5,14 +5,24 @@
<head>
<meta charset="utf-8"/>
<title>{% block page-title %}Panik DB{% endblock %}</title>
<link rel="stylesheet" type="text/css" media="all" href="{{ STATIC_URL }}css/style.css"/>
<script src="{{ STATIC_URL }}js/jquery.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/jquery.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/bootstrap.js"></script>
<link href="{{ STATIC_URL }}css/bootstrap.css" rel="stylesheet" type="text/css"/>
<script src="{{ STATIC_URL }}js/jquery-ui.js"></script>
<script src="{{ STATIC_URL }}js/jquery.fileupload.js"></script>
<script src="{{ STATIC_URL }}js/jquery.iframe-transport.js"></script>
<script src="{{ STATIC_URL }}js/qommon.fileupload.js"></script>
<link href="{{ STATIC_URL }}css/datetimepicker.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="{{ STATIC_URL }}js/bootstrap-datetimepicker.js"></script>
<link rel="stylesheet" type="text/css" media="all" href="{{ STATIC_URL }}css/style.css"/>
<!-- <script src="{{ STATIC_URL }}js/qommon.ahah.js"></script> -->
<link rel="stylesheet" type="text/css" media="all" href="{{ STATIC_URL }}css/smoothness/jquery-ui-1.10.0.custom.css"/>
{% block extrascripts %}
{% endblock %}
</head>
......
......@@ -4,3 +4,6 @@ django-ckeditor
django-taggit
git+https://github.com/toastdriven/django-haystack.git
django-registration
django-jquery
django-datetime-widget
django-bootstrap-staticfiles
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment