show edit button in changeset view
This commit is contained in:
parent
ded19de8e9
commit
ba3826fcf4
3 changed files with 25 additions and 0 deletions
|
@ -137,6 +137,11 @@ form button.invisiblesubmit {
|
|||
.change-group tr th small {
|
||||
font-weight:normal;
|
||||
}
|
||||
.change-group tr th .btn.pull-right {
|
||||
margin-right: -5px;
|
||||
margin-top: -2px;
|
||||
margin-bottom: -3px;
|
||||
}
|
||||
.change-group tr td:first-child {
|
||||
width:23px;
|
||||
padding-right:0;
|
||||
|
|
|
@ -16,6 +16,11 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th colspan="3">
|
||||
{% if group.edit_url %}
|
||||
<a class="btn btn-default btn-xs pull-right" href="{{ group.edit_url }}">
|
||||
{% trans 'Edit' %}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if group.obj_title %}
|
||||
{{ group.obj_title }} <small>({{ group.obj }})</small>
|
||||
{% else %}
|
||||
|
|
|
@ -377,11 +377,26 @@ def changeset_detail(request, pk):
|
|||
obj_desc = _('%(model)s #%(id)s') % {'model': obj.__class__._meta.verbose_name, 'id': pk}
|
||||
if is_created_pk(pk):
|
||||
obj_desc = _('%s (created)') % obj_desc
|
||||
obj_still_exists = int(pk[1:]) in changeset.created_objects[obj.__class__]
|
||||
else:
|
||||
obj_still_exists = pk not in changeset.deleted_existing[obj.__class__]
|
||||
|
||||
edit_url = None
|
||||
if obj_still_exists and changeset == request.changeset:
|
||||
reverse_kwargs = {'pk': obj.pk}
|
||||
if hasattr(obj, 'level'):
|
||||
reverse_kwargs['level'] = obj.level_id
|
||||
elif hasattr(obj, 'space'):
|
||||
reverse_kwargs['space'] = obj.space_id
|
||||
edit_url = reverse('editor.'+obj.__class__._meta.default_related_name+'.edit', kwargs=reverse_kwargs)
|
||||
|
||||
grouped_changes.append({
|
||||
'model': obj.__class__,
|
||||
'model_title': obj.__class__._meta.verbose_name,
|
||||
'obj': obj_desc,
|
||||
'obj_title': obj.title if obj.titles else None,
|
||||
'changes': changes,
|
||||
'edit_url': edit_url,
|
||||
})
|
||||
last_obj = obj
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue