Skip to content

Commit f47eb3f

Browse files
author
Ross Mechanic
authored
Revert GH-641 (#648)
1 parent 49626c3 commit f47eb3f

File tree

4 files changed

+2
-27
lines changed

4 files changed

+2
-27
lines changed

AUTHORS.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ Authors
8282
- Prakash Venkatraman (`dopatraman <https://github.com/dopatraman>`_)
8383
- Rajesh Pappula
8484
- Ray Logel
85-
- Reza Pourmeshki (`partizaans <https://github.com/partizaans>`_)
8685
- Roberto Aguilar
8786
- Rod Xavier Bondoc
8887
- Ross Lote

CHANGES.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ Changes
1010
to avoid possible `AppRegistryNotReady` exception (gh-630)
1111
- Fix `utils.update_change_reason` when user specifies excluded_fields (gh-637)
1212
- Changed how `now` is imported from `timezone` (`timezone` module is imported now) (gh-643)
13-
- Render fields as readonly in history detail view if `SIMPLE_HISTORY_EDIT` is not set
14-
`True` (gh-641)
1513
- settings.SIMPLE_HISTORY_REVERT_DISABLED if True removes the Revert
1614
button from the history form for all historical models (gh-632))
1715

simple_history/admin.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,7 @@ def history_form_view(self, request, object_id, version_id, extra_context=None):
175175
form,
176176
self.get_fieldsets(request, obj),
177177
self.prepopulated_fields,
178-
self.get_readonly_fields(request, obj)
179-
if change_history
180-
else self.get_fields(request, obj),
178+
self.get_readonly_fields(request, obj),
181179
model_admin=self,
182180
)
183181

simple_history/tests/tests/test_admin.py

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,7 @@ def test_history_form_permission(self):
154154
def test_invalid_history_form(self):
155155
self.login()
156156
poll = Poll.objects.create(question="why?", pub_date=today)
157-
with patch("simple_history.admin.SIMPLE_HISTORY_EDIT", True):
158-
response = self.client.post(get_history_url(poll, 0), data={"question": ""})
157+
response = self.client.post(get_history_url(poll, 0), data={"question": ""})
159158
self.assertEqual(response.status_code, 200)
160159
self.assertContains(response, "This field is required")
161160

@@ -201,25 +200,6 @@ def test_history_form(self):
201200
[p.history_user for p in Poll.history.all()], [self.user, None, None]
202201
)
203202

204-
def test_readonly_history_form_without_setting_simple_history_edit(self):
205-
self.login()
206-
poll = Poll.objects.create(question="why?", pub_date=today)
207-
poll.question = "how?"
208-
poll.save()
209-
response = self.client.get(get_history_url(poll, 0))
210-
readonly_fields = response.context["adminform"].readonly_fields
211-
self.assertCountEqual(["question", "pub_date"], readonly_fields)
212-
213-
def test_readonly_history_form_with_enabled_simple_history_edit(self):
214-
self.login()
215-
poll = Poll.objects.create(question="why?", pub_date=today)
216-
poll.question = "how?"
217-
poll.save()
218-
with patch("simple_history.admin.SIMPLE_HISTORY_EDIT", True):
219-
response = self.client.get(get_history_url(poll, 0))
220-
readonly_fields = response.context["adminform"].readonly_fields
221-
self.assertEqual(0, len(readonly_fields))
222-
223203
def test_history_user_on_save_in_admin(self):
224204
self.login()
225205

0 commit comments

Comments
 (0)