Project

General

Profile

« Previous | Next » 

Revision e4729afc

Added by Serghei Mihai over 10 years ago

announce publication and expiration dates displayed in form

View differences:

corbo/forms.py
3 3
from .models import Announce, Category
4 4

  
5 5
class AnnounceForm(forms.ModelForm):
6

  
6 7
    class Meta:
7 8
        model = Announce
8
        exclude = ('publication_time', 'expiration_time')
9
        widgets = {
10
            'publication_time': forms.TextInput(attrs={'class': 'datepicker',
11
                                                       'size': 8}),
12
            'expiration_time': forms.TextInput(attrs={'class': 'datepicker',
13
                                                      'size': 8})
14
        }
9 15

  
10 16
class CategoryForm(forms.ModelForm):
11 17
    class Meta:
corbo/models.py
18 18
    text = RichTextField(_('Content'))
19 19
    publication_time = models.DateTimeField(_('publication time'), blank=True,
20 20
                                            null=True)
21
    expiration_time = models.DateTimeField(_('expiration time'), blank=True,
21
    expiration_time = models.DateTimeField(_('Expires on'), blank=True,
22 22
                                           null=True)
23 23
    ctime = models.DateTimeField(_('creation time'), auto_now_add=True)
24 24
    mtime = models.DateTimeField(_('modification time'), auto_now=True)
corbo/static/css/corbo.css
206 206
    content: '\f1f8';
207 207
}
208 208

  
209
.status .icon {
210
    color: #888;
211
}
212

  
209 213
.status .published:before {
210 214
    content: '\f1ea';
211 215
}
......
256 260
a.add:before {
257 261
    content: '\f067';
258 262
    padding-right:3px;
259
}
263
}
264

  
265
form ul li {
266
    list-style-type: none;
267
    margin: 5px 0;
268
}
269

  
270
form ul li label {
271
    display: block;
272
}
corbo/templates/corbo/announce_form.html
4 4
<form method="post">
5 5
  {% csrf_token %}
6 6
  {{ form.media }}
7
  {{ form.as_p }}
8
  <button>{% trans "Save" %}</button>
7
  <ul>
8
  {{ form.as_ul }}
9
  <li>
10
    <button>{% trans "Save" %}</button>
11
  </li>
12
  </ul>
13
  <script type="text/javascript">
14
    $(function() {
15
        $(".datepicker" ).datepicker();
16
    });
17
</script>
9 18
</form>
10 19
{% endblock %}

Also available in: Unified diff