Project

General

Profile

« Previous | Next » 

Revision b94039e0

Added by Serghei Mihai over 9 years ago

objects management forms and templates reviewed

View differences:

corbo/forms.py
5 5
class AnnounceForm(forms.ModelForm):
6 6
    class Meta:
7 7
        model = Announce
8
        exclude = ('publication_time', 'expiration_time')
8 9

  
9 10
class CategoryForm(forms.ModelForm):
10 11
    class Meta:
12
        fields = ('name', )
11 13
        model = Category
corbo/static/css/corbo.css
198 198
    width: 20px;
199 199
}
200 200

  
201
.actions .edit:before {
201
.edit:before {
202 202
    content: '\f044';
203 203
}
204 204

  
205
.actions .delete:before {
205
.delete:before {
206 206
    content: '\f1f8';
207 207
}
208 208

  
......
247 247

  
248 248
.categories a, #management > span a {
249 249
    color: #000;
250
    border: 1px solid #666;
251 250
    padding: 1px 3px;
252 251
    margin: 0;
253 252
    font-weight: bold;
254 253
    font-size: .75em;
255
    background: #eee;
256 254
}
257 255

  
258 256
a.add:before {
corbo/templates/corbo/announce_confirm_delete.html
1
{% extends "corbo/manage.html" %}
2
{% load i18n %}
3
{% block content %}
4
<form method="post">
5
  <h5>
6
    {% blocktrans with title=object.title %}
7
    Are you sure you want to delete the announce "{{ title }}" ?
8
    {% endblocktrans %}
9
  </h5>
10
  {% csrf_token %}
11
  <button>{% trans "Delete" %}</button>
12
</form>
13
{% endblock %}
corbo/templates/corbo/category_confirm_delete.html
1
{% extends "corbo/manage.html" %}
2
{% load i18n %}
3
{% block content %}
4
<form method="post">
5
  {% csrf_token %}
6
  <h5>
7
    {% blocktrans with name=object.name %}
8
    Are you sure you want to delete category "{{ name }}"?
9
    {% endblocktrans %}
10
  </h5>
11
    <p class="text_preview">{% trans "All its announces of will be also deleted" %}</p>
12
  <button>{% trans "Delete" %}</button>
13
</form>
14
{% endblock %}
corbo/templates/corbo/manage.html
15 15
    <option value='{{ category.id }}'{% if category_id == category.id %} selected{% endif %}>{{ category }}</option>
16 16
    {% endfor %}
17 17
  </select>
18
  <span><a class="icon add" href="{% url "add_category" %}" rel="popup">{% trans "add category" %}</a></span>
18
  <span>
19
    {% if category_id %}
20
    <a class="icon edit" href="{% url "edit_category" category_id %}" rel="popup" title="{% trans "edit category" %}"></a>
21
    <a class="icon delete" href="{% url "delete_category" category_id %}" rel="popup" title="{% trans "delete category" %}"></a>
22
    {% endif %}
23
    <a class="icon add" href="{% url "add_category" %}" rel="popup" title="{% trans "add category" %}"></a></span>
19 24
</div>
20 25
<div id="management">
21 26
  <h4>{% trans "Announces" %}</h4>
corbo/views.py
25 25

  
26 26
class AnnounceEditView(UpdateView):
27 27
    model = models.Announce
28
    form_class = AnnounceForm
28 29
    success_url = '../..'
29 30

  
30 31
edit_announce = AnnounceEditView.as_view()
......
47 48
add_category = CategoryCreateView.as_view()
48 49

  
49 50
class CategoryEditView(UpdateView):
51
    form_class = CategoryForm
50 52
    model = models.Category
51
    success_url = '..'
53
    success_url = '../..'
52 54

  
53 55
edit_category = CategoryEditView.as_view()
54 56

  
55 57
class DeleteView(DeleteView):
56 58
    model = models.Category
59
    success_url = '../..'
57 60

  
58 61
delete_category = DeleteView.as_view()
59 62

  

Also available in: Unified diff