apply → accept and remove author from ChangeSetUpdate

This commit is contained in:
Laura Klünder 2017-07-05 21:39:31 +02:00
parent 2724f082a6
commit e1b776a03c
6 changed files with 37 additions and 9 deletions

View file

@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-05 19:38
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('editor', '0015_changeset_last_state_update'),
]
operations = [
migrations.RemoveField(
model_name='changesetupdate',
name='author',
),
migrations.AlterField(
model_name='changeset',
name='state',
field=models.CharField(choices=[('unproposed', 'unproposed'), ('proposed', 'proposed'), ('review', 'in review'), ('rejected', 'rejected'), ('reproposed', 'proposed again'), ('finallyrejected', 'finally rejected'), ('applied', 'accepted and applied')], db_index=True, default='unproposed', max_length=20),
),
migrations.AlterField(
model_name='changesetupdate',
name='state',
field=models.CharField(choices=[('unproposed', 'unproposed'), ('proposed', 'proposed'), ('review', 'in review'), ('rejected', 'rejected'), ('reproposed', 'proposed again'), ('finallyrejected', 'finally rejected'), ('applied', 'accepted and applied')], db_index=True, max_length=20, null=None),
),
]

View file

@ -24,9 +24,9 @@ class ChangeSet(models.Model):
('proposed', _('proposed')),
('review', _('in review')),
('rejected', _('rejected')),
('reproposed', _('reproposed')),
('reproposed', _('proposed again')),
('finallyrejected', _('finally rejected')),
('applied', _('accepted')),
('applied', _('accepted and applied')),
)
created = models.DateTimeField(auto_now_add=True, verbose_name=_('created'))
last_change = models.ForeignKey('editor.ChangeSetUpdate', null=True, related_name='+',

View file

@ -12,7 +12,6 @@ class ChangeSetUpdate(models.Model):
user = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, on_delete=models.PROTECT, related_name='+')
state = models.CharField(null=None, db_index=True, choices=ChangeSet.STATES, max_length=20)
author = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, on_delete=models.PROTECT, related_name='+')
title = models.CharField(max_length=100, null=True)
description = models.TextField(max_length=1000, null=True)
assigned_to = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, on_delete=models.PROTECT, related_name='+')

View file

@ -142,7 +142,7 @@
{% endif %}
{% if can_end_review %}
<button type="submit" class="btn btn-danger" name="reject" value="1">{% trans 'Reject' %}</button>
<button type="submit" class="btn btn-success" name="apply" value="1">{% trans 'Apply' %}</button>
<button type="submit" class="btn btn-success" name="apply" value="1">{% trans 'Accept' %}</button>
{% endif %}
{% endif %}
{% if not active and not changeset.closed %}

View file

@ -2,10 +2,10 @@
{% load i18n %}
{% include 'editor/fragment_modal_close.html' %}
<h3>{% trans 'Apply these changes' %}</h3>
<h3>{% trans 'Accept and apply changes' %}</h3>
<form action="{{ request.path }}" method="post">
{% csrf_token %}
<p>{% trans 'Do you really want to apply these changes?' %}</p>
<p>{% trans 'Do you really want to accept and apply these changes?' %}</p>
<input type="hidden" name="apply" value="1">
{% buttons %}
<button class="invisiblesubmit" type="submit"></button>
@ -13,7 +13,7 @@
{% trans 'Cancel' %}
</a>
<button type="submit" name="apply_confirm" value="1" class="btn btn-success pull-right">
{% trans 'Apply' %}
{% trans 'Accept and apply' %}
</button>
{% endbuttons %}
</form>

View file

@ -131,12 +131,12 @@ def changeset_detail(request, pk):
elif request.POST.get('apply') == '1':
with changeset.lock_to_edit() as changeset:
if not changeset.can_end_review(request):
messages.error(request, _('You cannot apply these changes.'))
messages.error(request, _('You cannot accept and apply these changes.'))
return redirect(reverse('editor.changesets.detail', kwargs={'pk': changeset.pk}))
if request.POST.get('apply_confirm') == '1':
changeset.apply(request.user)
messages.success(request, _('You applied these changes.'))
messages.success(request, _('You accepted and applied these changes.'))
return redirect(reverse('editor.changesets.detail', kwargs={'pk': changeset.pk}))
return render(request, 'editor/changeset_apply.html', {})