mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-09 19:40:19 +00:00
Add first Matmat' app
This commit is contained in:
26
core/templates/core/user_preferences.jinja
Normal file
26
core/templates/core/user_preferences.jinja
Normal file
@ -0,0 +1,26 @@
|
||||
{% extends "core/base.jinja" %}
|
||||
|
||||
{% block title %}
|
||||
{% trans %}Preferences{% endtrans %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2>{% trans %}Preferences{% endtrans %}</h2>
|
||||
<form action="" method="post" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p() }}
|
||||
<p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p>
|
||||
</form>
|
||||
{% if matmat_form %}
|
||||
<form action="{{ url('matmat:user_tools') }}" method="post" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
{{ matmat_form.as_p() }}
|
||||
<p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p>
|
||||
</form>
|
||||
{% else %}
|
||||
<p><a href="{{ url('matmat:user_tools') }}">Matmatronch tools</a></p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
@ -46,6 +46,7 @@ from core.views.forms import RegisteringForm, UserPropForm, UserProfileForm, Log
|
||||
from core.models import User, SithFile, Preferences
|
||||
from club.models import Club
|
||||
from subscription.models import Subscription
|
||||
from matmat.views import UserMatmatForm
|
||||
|
||||
def login(request):
|
||||
"""
|
||||
@ -427,7 +428,7 @@ class UserPreferencesView(UserTabsMixin, CanEditMixin, UpdateView):
|
||||
"""
|
||||
model = User
|
||||
pk_url_kwarg = "user_id"
|
||||
template_name = "core/edit.jinja"
|
||||
template_name = "core/user_preferences.jinja"
|
||||
form_class = modelform_factory(Preferences, fields=['receive_weekmail'])
|
||||
context_object_name = "profile"
|
||||
current_tab = "prefs"
|
||||
@ -446,6 +447,12 @@ class UserPreferencesView(UserTabsMixin, CanEditMixin, UpdateView):
|
||||
kwargs.update({'instance': pref})
|
||||
return kwargs
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
kwargs = super(UserPreferencesView, self).get_context_data(**kwargs)
|
||||
if not hasattr(self.object, 'matmat_user'):
|
||||
kwargs['matmat_form'] = UserMatmatForm()
|
||||
return kwargs
|
||||
|
||||
class UserUpdateGroupView(UserTabsMixin, CanEditPropMixin, UpdateView):
|
||||
"""
|
||||
Edit a user's groups
|
||||
|
Reference in New Issue
Block a user