move changeset history view into changeset_detail
This commit is contained in:
parent
0a3675b9ef
commit
7d768875d5
2 changed files with 8 additions and 17 deletions
|
@ -14,14 +14,17 @@ from c3nav.mapdata.models.locations import LocationRedirect, LocationSlug
|
|||
|
||||
|
||||
@sidebar_view
|
||||
def changeset_detail(request, pk):
|
||||
def changeset_detail(request, pk, show_history=False):
|
||||
can_edit = True
|
||||
changeset = request.changeset
|
||||
if str(pk) != str(request.changeset.pk):
|
||||
can_edit = False
|
||||
changeset = get_object_or_404(ChangeSet.qs_for_request(request), pk=pk)
|
||||
|
||||
ctx = group_changes(changeset, can_edit=can_edit, show_history=False)
|
||||
ctx = group_changes(changeset, can_edit=can_edit, show_history=show_history)
|
||||
|
||||
if show_history:
|
||||
return render(request, 'editor/changeset_history.html', ctx)
|
||||
|
||||
if request.method == 'POST':
|
||||
if request.POST.get('delete') == '1':
|
||||
|
@ -38,19 +41,6 @@ def changeset_detail(request, pk):
|
|||
return render(request, 'editor/changeset.html', ctx)
|
||||
|
||||
|
||||
@sidebar_view
|
||||
def changeset_history(request, pk):
|
||||
can_edit = True
|
||||
changeset = request.changeset
|
||||
if str(pk) != str(request.changeset.pk):
|
||||
can_edit = False
|
||||
changeset = get_object_or_404(ChangeSet.qs_for_request(request), pk=pk)
|
||||
|
||||
ctx = group_changes(changeset, can_edit=can_edit, show_history=True)
|
||||
|
||||
return render(request, 'editor/changeset_history.html', ctx)
|
||||
|
||||
|
||||
def group_changes(changeset, can_edit=False, show_history=False):
|
||||
changeset.parse_changes(get_history=show_history)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue