Commit dec1a2cd authored by Skia's avatar Skia

Add profile form in matmat

parent e00c948d
Pipeline #965 passed with stage
in 4 minutes and 13 seconds
......@@ -14,6 +14,9 @@
</form>
{% else %}
<p>{% trans matmat = user.matmat_user.matmat %}You are subscribed to the Matmatronch {{ matmat }}{% endtrans %}</p>
<p><a href="{{ url("matmat:profile") }}">Edit my profile</a></p>
<hr>
<div>
{% for u in user.matmat_user.matmat.users.exclude(id=user.matmat_user.id) %}
<div class="ib">
<div>{{ u.user.get_display_name() }}</div>
......@@ -25,6 +28,7 @@
{% endif %}
</div>
{% endfor %}
</div>
{% endif %}
{% endblock %}
......@@ -34,5 +34,6 @@ urlpatterns = [
url(r'^(?P<user_id>[0-9]+)/new_comment$', MatmatCommentCreateView.as_view(), name='new_comment'),
url(r'^comment/(?P<comment_id>[0-9]+)/edit$', MatmatCommentEditView.as_view(), name='edit_comment'),
url(r'^tools$', UserMatmatToolsView.as_view(), name='user_tools'),
url(r'^profile$', UserMatmatEditProfileView.as_view(), name='profile'),
]
......@@ -118,6 +118,22 @@ class UserMatmatToolsView(QuickNotifMixin, TemplateView):
kwargs['subscribe_form'] = UserMatmatForm()
return kwargs
class UserMatmatEditProfileView(UpdateView):
model = User
form_class = modelform_factory(User,
fields=['second_email', 'phone', 'department', 'dpt_option',
'quote', 'parent_address'],
labels={
'second_email': _("Personal email (not UTBM)"),
'phone': _("Phone"),
'parent_address': _("Native town"),
})
template_name = "core/edit.jinja"
success_url = reverse_lazy('matmat:user_tools')
def get_object(self):
return self.request.user
class MatmatCommentFormView():
"""
Create/edit a matmat comment
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment