|
@@ -7,14 +7,12 @@ from django.shortcuts import render, redirect
|
7
|
7
|
from django.urls.base import reverse
|
8
|
8
|
from django.utils import timezone
|
9
|
9
|
from django.utils.translation import gettext as _
|
10
|
|
-from .forms import TaskForm, TaskFormLimited, ProjectForm, CommentForm, TaskCommentForm, SearchForm, EasySearchForm, PattUserProfileForm
|
|
10
|
+from .forms import TaskForm, TaskFormLimited, ProjectForm, CommentForm, TaskCommentForm, SearchForm, EasySearchForm
|
11
|
11
|
from .help import help_pages
|
12
|
12
|
from .models import Task, ModelList, Comment, TASKSTATE_CHOICES, PRIO_CHOICES, TASKS_IN_WORK
|
13
|
|
-from .models import Project, Search, get_pattuserprofile
|
|
13
|
+from .models import Project, Search
|
14
|
14
|
import patt
|
15
|
15
|
from .search import load_index, search, mk_search_pattern, get_project_ids_from_search_pattern, common_searches
|
16
|
|
-from users.forms import UserProfileForm
|
17
|
|
-from users.models import get_userprofile
|
18
|
16
|
from themes import Context
|
19
|
17
|
|
20
|
18
|
|
|
@@ -144,42 +142,6 @@ def get_next(request):
|
144
|
142
|
return request.POST.get('next', '/')
|
145
|
143
|
|
146
|
144
|
|
147
|
|
-def profile_post_actions(request, context):
|
148
|
|
- if request.POST:
|
149
|
|
- form = context.get('form_userprofile')
|
150
|
|
- if form.is_valid():
|
151
|
|
- form.save()
|
152
|
|
- form = context.get('form_pattprofile')
|
153
|
|
- if form.is_valid():
|
154
|
|
- form.save()
|
155
|
|
- return redirect(request.GET.get('next') or '/')
|
156
|
|
-
|
157
|
|
-
|
158
|
|
-def profile_pre_actions(request, context, form_to_be_used=UserProfileForm):
|
159
|
|
- user_profile = get_userprofile(request.user)
|
160
|
|
- patt_user_profile = get_pattuserprofile(request.user)
|
161
|
|
- if request.POST:
|
162
|
|
- userprofile_form = UserProfileForm(request.POST, instance=user_profile)
|
163
|
|
- pattprofile_form = PattUserProfileForm(request.POST, instance=patt_user_profile)
|
164
|
|
- else:
|
165
|
|
- userprofile_form = UserProfileForm(instance=user_profile)
|
166
|
|
- pattprofile_form = PattUserProfileForm(instance=patt_user_profile)
|
167
|
|
- context['form_userprofile'] = userprofile_form
|
168
|
|
- context['form_pattprofile'] = pattprofile_form
|
169
|
|
-
|
170
|
|
-
|
171
|
|
-@login_required
|
172
|
|
-def patt_profile(request):
|
173
|
|
- context = Context(request) # needs to be executed first because of time mesurement
|
174
|
|
- profile_pre_actions(request, context)
|
175
|
|
- response = profile_post_actions(request, context)
|
176
|
|
- if response is not None:
|
177
|
|
- return response
|
178
|
|
- else:
|
179
|
|
- context_adaption(context, request, title=_('Profile for %(username)s') % {'username': request.user.username})
|
180
|
|
- return render(request, 'patt/profile.html', context=context)
|
181
|
|
-
|
182
|
|
-
|
183
|
145
|
@login_required
|
184
|
146
|
def patt_tasklist(request, user_filter_id=None, common_filter_id=None):
|
185
|
147
|
context = Context(request) # needs to be executed first because of time mesurement
|