0001-manager-fix-redirect-url-after-announce-edit-15110.patch
corbo/views.py | ||
---|---|---|
87 | 87 |
return context |
88 | 88 | |
89 | 89 |
def get_success_url(self): |
90 |
return reverse('view_category', kwargs={'pk': self.object.category.pk})
|
|
90 |
return reverse('view_category', kwargs={'slug': self.object.category.slug})
|
|
91 | 91 | |
92 | 92 | |
93 | 93 |
edit_announce = AnnounceEditView.as_view() |
tests/test_manager.py | ||
---|---|---|
92 | 92 |
assert resp.status_int == 302 |
93 | 93 |
assert resp.location == 'http://localhost:80/manage/category/alerts/' |
94 | 94 | |
95 |
def test_edit_announce(app, admin_user): |
|
96 |
app = login(app) |
|
97 |
category_page = app.get(reverse('add_category')) |
|
98 |
category_form = category_page.forms[0] |
|
99 |
category_form['name'] = 'Alerts' |
|
100 |
resp = category_form.submit() |
|
101 |
assert resp.status_int == 302 |
|
102 |
assert resp.location == 'http://localhost:80/manage/' |
|
103 |
announce_page = app.get(reverse('add_announce', kwargs={'slug': 'alerts'})) |
|
104 |
announce_form = announce_page.forms[0] |
|
105 |
announce_form['title'] = 'First announce' |
|
106 |
announce_form['text'] = 'announce content' |
|
107 |
resp = announce_form.submit() |
|
108 |
assert resp.status_int == 302 |
|
109 |
assert resp.location == 'http://localhost:80/manage/category/alerts/' |
|
110 |
announce_edit_page = app.get(reverse('edit_announce', kwargs={'pk': '1'})) |
|
111 |
edit_form = announce_edit_page.forms[0] |
|
112 |
edit_form['publication_time'] = '2017-03-03 09:00:00' |
|
113 |
resp = edit_form.submit() |
|
114 |
assert resp.status_int == 302 |
|
115 |
assert resp.location == 'http://localhost:80/manage/category/alerts/' |
|
95 | 116 | |
96 | 117 |
def test_delete_announce(app, admin_user): |
97 | 118 |
app = login(app) |
98 |
- |