Add first Matmat' app

This commit is contained in:
Skia
2017-05-09 23:42:01 +02:00
parent 5060114305
commit b3bc33a319
15 changed files with 460 additions and 1 deletions

View File

@ -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