mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-21 21:53:30 +00:00
Add profile form in matmat
This commit is contained in:
parent
e00c948da9
commit
dec1a2cdd7
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user