diff --git a/taskapp/models.py b/taskapp/models.py index e484e04..f4db733 100644 --- a/taskapp/models.py +++ b/taskapp/models.py @@ -18,7 +18,7 @@ TASK_PRIORITIES = ( TASK_STATES = ( ('S', _('New')), - ('C', _('In fulfilling')), + ('C', _('Confused')), ('F', _('Completed')) ) @@ -44,7 +44,7 @@ class ChangeLog(models.Model): ('c', _('Create task')), ('d', _('Delete task')), ('f', _('Completing tasks')), - ('b', _('The task started')) + ('b', _('The task failed')) ) act_type = models.CharField(max_length=1, choices=ACT_CHOICES) when = models.DateTimeField(auto_now_add=True) @@ -89,8 +89,8 @@ class Task(models.Model): ) self.save(update_fields=['state', 'out_date']) - def begin(self, current_user): - self.state = 'C' # Начата + def do_fail(self, current_user): + self.state = 'C' # Провалена ChangeLog.objects.create( task=self, act_type='b', diff --git a/taskapp/templates/taskapp/ext.htm b/taskapp/templates/taskapp/ext.htm index c955a40..04412ba 100644 --- a/taskapp/templates/taskapp/ext.htm +++ b/taskapp/templates/taskapp/ext.htm @@ -23,13 +23,6 @@ - {% url 'taskapp:active_tasks' as taskactive %} - - - {% trans 'Active tasks' %} - - - {% url 'taskapp:finished_tasks' as taskfin %} @@ -44,6 +37,13 @@ + {% url 'taskapp:failed_tasks' as taskfailed %} + + + {% trans 'Failed tasks' %} + + + {% url 'taskapp:my_tasks' as taskmy %} diff --git a/taskapp/templates/taskapp/tasklist.html b/taskapp/templates/taskapp/tasklist.html index 7788eaa..a14091c 100644 --- a/taskapp/templates/taskapp/tasklist.html +++ b/taskapp/templates/taskapp/tasklist.html @@ -33,7 +33,7 @@ {% endif %} {% endif %} - {{ task.id }} + {{ task.pk }} {% if task.abon and task.abon.group %} {{ task.abon.get_full_name }} @@ -45,19 +45,19 @@ {{ task.get_mode_display }} {{ task.descr }} - {{ task.author.username }} - {{ task.time_of_create|date:'d N Y H:i:s' }} + {{ task.time_of_create|date:'d E H:i' }} - - - - - + + + + + {% if perms.taskapp.change_task %} - + {% endif %} diff --git a/taskapp/templates/taskapp/tasklist_all.html b/taskapp/templates/taskapp/tasklist_all.html index 6878c2a..710efc1 100644 --- a/taskapp/templates/taskapp/tasklist_all.html +++ b/taskapp/templates/taskapp/tasklist_all.html @@ -46,7 +46,7 @@ {% endif %} {% endif %} - {{ task.id }} + {{ task.pk }} {% if task.abon and task.abon.group %} {{ task.abon.get_full_name }} @@ -59,22 +59,24 @@ {{ task.get_mode_display }} {{ task.descr }} {% if task.author %} - {{ task.author.username }} + + {{ task.author.username }} + {% else %} {% trans 'Not assigned' %} {% endif %} {{ task.get_state_display }} - {{ task.time_of_create|date:'d N Y H:i:s' }} + {{ task.time_of_create|date:'d E H:i' }} - + {% if perms.taskapp.change_task %} - + {% endif %} {% if perms.taskapp.can_remind %} - + {% endif %} @@ -90,7 +92,7 @@ {% if perms.taskapp.add_task %} - + {% trans 'Add new task' %} {% endif %} diff --git a/taskapp/templates/taskapp/tasklist_active.html b/taskapp/templates/taskapp/tasklist_failed.html similarity index 84% rename from taskapp/templates/taskapp/tasklist_active.html rename to taskapp/templates/taskapp/tasklist_failed.html index c325927..d93402d 100644 --- a/taskapp/templates/taskapp/tasklist_active.html +++ b/taskapp/templates/taskapp/tasklist_failed.html @@ -33,7 +33,7 @@ {% endif %} {% endif %} - {{ task.id }} + {{ task.pk }} {% if task.abon and task.abon.group %} {{ task.abon.get_full_name }} @@ -45,16 +45,16 @@ {{ task.get_mode_display }} {{ task.descr }} - {{ task.author.username }} - {{ task.time_of_create|date:'d N Y H:i:s' }} + {{ task.time_of_create|date:'d E H:i' }} - - + + {% if perms.taskapp.change_task %} - + {% endif %} diff --git a/taskapp/templates/taskapp/tasklist_finish.html b/taskapp/templates/taskapp/tasklist_finish.html index 3dab8a6..70caf9e 100644 --- a/taskapp/templates/taskapp/tasklist_finish.html +++ b/taskapp/templates/taskapp/tasklist_finish.html @@ -8,12 +8,12 @@ # {% trans 'Name' %} - {% trans 'Address' %} + {% trans 'Address' %} {% trans 'The nature of the damage' %} {% trans 'Description' %} {% trans 'Task author' %} {% trans 'Date of create' %} - {% trans 'Actions' %} + # @@ -33,7 +33,7 @@ {% endif %} {% endif %} - {{ task.id }} + {{ task.pk }} {% if task.abon and task.abon.group %} {{ task.abon.get_full_name }} @@ -45,21 +45,16 @@ {{ task.get_mode_display }} {{ task.descr }} - {{ task.author.username }} - {{ task.time_of_create|date:'d N Y H:i:s' }} + {{ task.time_of_create|date:'d E H:i' }} - + {% if perms.taskapp.change_task %} - + {% endif %} - {% if perms.taskapp.delete_task %} - - - - {% endif %} {% empty %} diff --git a/taskapp/templates/taskapp/tasklist_own.html b/taskapp/templates/taskapp/tasklist_own.html index 030d4db..19f4348 100644 --- a/taskapp/templates/taskapp/tasklist_own.html +++ b/taskapp/templates/taskapp/tasklist_own.html @@ -46,7 +46,7 @@ {{ task.get_mode_display }} {{ task.descr }} {{ task.get_state_display }} - {{ task.time_of_create|date:'d N Y H:i:s' }} + {{ task.time_of_create|date:'d E H:i' }} {% if perms.taskapp.change_task %} diff --git a/taskapp/templates/taskapp/view.html b/taskapp/templates/taskapp/view.html index 5dfe159..0c0a927 100644 --- a/taskapp/templates/taskapp/view.html +++ b/taskapp/templates/taskapp/view.html @@ -5,7 +5,7 @@ {% include 'message_block.html' %} @@ -18,23 +18,23 @@

{% trans 'Description' %}: {{ task.descr }}

- {% trans 'Task author' %}: {{ task.author.username }}
+ {% trans 'Task author' %}: {{ task.author.username }}
{% trans 'Implementers' %}: {% trans 'A priority' %}: {{ task.get_priority_display }}
{% trans 'The task is valid until' %} {{ task.out_date|date:'d E Y' }}
- {% trans 'Date of create' %} {{ task.time_of_create|date:'d E Y' }}
+ {% trans 'Date of create' %} {{ task.time_of_create|date:'d E Y H:i:s' }}
{% trans 'time left' %} {{ time_diff }}
{% trans 'Task type' %}: {{ task.get_mode_display }}
{% trans 'Condition' %}: {{ task.get_state_display }}
{% trans 'Subscriber' %} {% if task.abon %} - {{ task.abon.get_full_name }} + {{ task.abon.get_full_name }} {% else %} {% trans 'Not assigned' %} {% endif %}
diff --git a/taskapp/urls.py b/taskapp/urls.py index e297e3c..e921f3b 100644 --- a/taskapp/urls.py +++ b/taskapp/urls.py @@ -9,10 +9,10 @@ urlpatterns = [ url(r'^(?P\d+)/edit$', views.task_add_edit, name='edit'), url(r'^(?P\d+)/delete$', views.task_delete, name='delete'), url(r'^(?P\d+)/fin$', views.task_finish, name='finish'), - url(r'^(?P\d+)/begin$', views.task_begin, name='begin'), + url(r'^(?P\d+)/fail$', views.task_failed, name='fail'), url(r'^(?P\d+)/remind', views.remind, name='remind'), url(r'^add$', views.task_add_edit, name='add'), - url(r'^active$', views.active_tasks, name='active_tasks'), + url(r'^failed$', views.failed_tasks, name='failed_tasks'), url(r'^finished$', views.finished_tasks, name='finished_tasks'), url(r'^own$', views.own_tasks, name='own_tasks'), url(r'^my$', views.my_tasks, name='my_tasks'), diff --git a/taskapp/views.py b/taskapp/views.py index ceb764e..c4e1966 100644 --- a/taskapp/views.py +++ b/taskapp/views.py @@ -23,10 +23,10 @@ def home(request): @login_required @only_admins -def active_tasks(request): - tasks = Task.objects.filter(recipients=request.user, state='C') # На выполнении +def failed_tasks(request): + tasks = Task.objects.filter(recipients=request.user, state='C') # Проваленные tasks = pag_mn(request, tasks) - return render(request, 'taskapp/tasklist_active.html', { + return render(request, 'taskapp/tasklist_failed.html', { 'tasks': tasks }) @@ -174,9 +174,9 @@ def task_finish(request, task_id): @login_required @only_admins -def task_begin(request, task_id): +def task_failed(request, task_id): task = get_object_or_404(Task, id=task_id) - task.begin(request.user) + task.do_fail(request.user) return redirect('taskapp:home')