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 | ||
---|---|---|
114 | 114 |
resp = app.get('http://localhost:80/manage/category/alerts/') |
115 | 115 |
assert 'First announce' in resp.content |
116 | 116 | |
117 |
def test_edit_announce(app, admin_user): |
|
118 |
app = login(app) |
|
119 |
category_page = app.get(reverse('add_category')) |
|
120 |
category_form = category_page.forms[0] |
|
121 |
category_form['name'] = 'Alerts' |
|
122 |
resp = category_form.submit() |
|
123 |
assert resp.status_int == 302 |
|
124 |
assert resp.location == 'http://localhost:80/manage/' |
|
125 |
resp = app.get(reverse('view_category', kwargs={'slug': 'alerts'})) |
|
126 |
assert 'New announce' in resp.content |
|
127 |
announce_page = resp.click(description='New announce') |
|
128 |
announce_form = announce_page.forms[0] |
|
129 |
announce_form['title'] = 'First announce' |
|
130 |
announce_form['text'] = 'announce content' |
|
131 |
resp = announce_form.submit() |
|
132 |
assert resp.status_int == 302 |
|
133 |
assert resp.location == 'http://localhost:80/manage/category/alerts/' |
|
134 |
announce_edit_page = app.get(reverse('edit_announce', kwargs={'pk': '1'})) |
|
135 |
edit_form = announce_edit_page.forms[0] |
|
136 |
edit_form['publication_time'] = '2017-03-03 09:00:00' |
|
137 |
resp = edit_form.submit() |
|
138 |
assert resp.status_int == 302 |
|
139 |
assert resp.location == 'http://localhost:80/manage/category/alerts/' |
|
117 | 140 | |
118 | 141 |
def test_delete_announce(app, admin_user): |
119 | 142 |
app = login(app) |
120 |
- |