Commit d90b319d4ddfc44ee17f86cefa93fd335241bb49
1 parent
6e6277fc
Exists in
master
and in
5 other branches
Profile title's included [Issue #429]
Showing
2 changed files
with
25 additions
and
9 deletions
Show diff stats
users/templates/users/profile.html
... | ... | @@ -11,12 +11,6 @@ |
11 | 11 | |
12 | 12 | {% endblock %} |
13 | 13 | |
14 | -{% block menu %} | |
15 | - {% if user|has_role:'system_admin' %} | |
16 | - <li> <a href="{% url 'users:create' %}">{% trans 'Add User' %}</a></li> | |
17 | - {% endif %} | |
18 | -{% endblock %} | |
19 | - | |
20 | 14 | {% block content %} |
21 | 15 | {% if messages %} |
22 | 16 | {% for message in messages %} | ... | ... |
users/views.py
... | ... | @@ -47,7 +47,7 @@ class UsersListView(HasRoleMixin, LoginRequiredMixin, generic.ListView): |
47 | 47 | |
48 | 48 | def get_context_data (self, **kwargs): |
49 | 49 | context = super(UsersListView, self).get_context_data(**kwargs) |
50 | - context['title'] = 'Manage Users' | |
50 | + context['title'] = 'Manage Users | Amadeus' | |
51 | 51 | return context |
52 | 52 | |
53 | 53 | class Create(HasRoleMixin, LoginRequiredMixin, generic.edit.CreateView): |
... | ... | @@ -72,12 +72,12 @@ class Create(HasRoleMixin, LoginRequiredMixin, generic.edit.CreateView): |
72 | 72 | |
73 | 73 | self.object.save() |
74 | 74 | |
75 | - messages.success(self.request, _('User ')+self.object.name+_(' created successfully!')) | |
75 | + messages.success(self.request, ('User ')+self.object.name+(' created successfully!')) | |
76 | 76 | |
77 | 77 | return super(Create, self).form_valid(form) |
78 | 78 | def get_context_data (self, **kwargs): |
79 | 79 | context = super(Create, self).get_context_data(**kwargs) |
80 | - context['title'] = _("Add User") | |
80 | + context['title'] = "Add User | Amadeus" | |
81 | 81 | return context |
82 | 82 | |
83 | 83 | class Update(HasRoleMixin, LoginRequiredMixin, generic.UpdateView): |
... | ... | @@ -109,6 +109,11 @@ class Update(HasRoleMixin, LoginRequiredMixin, generic.UpdateView): |
109 | 109 | |
110 | 110 | return super(Update, self).form_valid(form) |
111 | 111 | |
112 | + def get_context_data (self, **kwargs): | |
113 | + context = super(Update, self).get_context_data(**kwargs) | |
114 | + context['title'] = "Update User | Amadeus" | |
115 | + return context | |
116 | + | |
112 | 117 | class View(LoginRequiredMixin, generic.DetailView): |
113 | 118 | |
114 | 119 | login_url = reverse_lazy("core:home") |
... | ... | @@ -119,6 +124,11 @@ class View(LoginRequiredMixin, generic.DetailView): |
119 | 124 | slug_field = 'username' |
120 | 125 | slug_url_kwarg = 'username' |
121 | 126 | |
127 | + def get_context_data (self, **kwargs): | |
128 | + context = super(View, self).get_context_data(**kwargs) | |
129 | + context['title'] = "User | Amadeus" | |
130 | + return context | |
131 | + | |
122 | 132 | def delete_user(request,username): |
123 | 133 | user = get_object_or_404(User,username = username) |
124 | 134 | user.delete() |
... | ... | @@ -134,6 +144,11 @@ def remove_account(request,username): |
134 | 144 | class Change_password(generic.TemplateView): |
135 | 145 | template_name = 'users/change_password.html' |
136 | 146 | |
147 | + def get_context_data (self, **kwargs): | |
148 | + context = super(Change_password, self).get_context_data(**kwargs) | |
149 | + context['title'] = "Change Password | Amadeus" | |
150 | + return context | |
151 | + | |
137 | 152 | class Remove_account(generic.TemplateView): |
138 | 153 | template_name = 'users/remove_account.html' |
139 | 154 | |
... | ... | @@ -150,6 +165,7 @@ class UpdateProfile(LoginRequiredMixin, generic.edit.UpdateView): |
150 | 165 | |
151 | 166 | def get_context_data(self, **kwargs): |
152 | 167 | context = super(UpdateProfile, self).get_context_data(**kwargs) |
168 | + context['title'] = 'Update Profile | Amadeus' | |
153 | 169 | if has_role(self.request.user, 'system_admin'): |
154 | 170 | context['form'] = UpdateProfileFormAdmin(instance = self.object) |
155 | 171 | else: |
... | ... | @@ -184,6 +200,12 @@ class Profile(LoginRequiredMixin, generic.DetailView): |
184 | 200 | def get_object(self): |
185 | 201 | user = get_object_or_404(User, username = self.request.user.username) |
186 | 202 | return user |
203 | + | |
204 | + def get_context_data (self, **kwargs): | |
205 | + context = super(Profile, self).get_context_data(**kwargs) | |
206 | + context['title'] = "Profile | Amadeus" | |
207 | + return context | |
208 | + | |
187 | 209 | class SearchView(LoginRequiredMixin, generic.ListView): |
188 | 210 | |
189 | 211 | login_url = reverse_lazy("core:home") | ... | ... |