fix merging

This commit is contained in:
Pierre Brunet 2017-06-13 10:48:04 +02:00
parent 69c95cfd37
commit 9447de4468
4 changed files with 19 additions and 17 deletions

View File

@ -25,6 +25,7 @@
from django.shortcuts import redirect from django.shortcuts import redirect
from django.http import HttpResponse from django.http import HttpResponse
from django.core.urlresolvers import reverse_lazy, reverse from django.core.urlresolvers import reverse_lazy, reverse
from core.views.forms import SelectDate
from django.views.generic import DetailView, TemplateView from django.views.generic import DetailView, TemplateView
from django.views.generic.edit import UpdateView, FormMixin, FormView from django.views.generic.edit import UpdateView, FormMixin, FormView
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
@ -130,7 +131,7 @@ class PictureView(CanViewMixin, DetailView, FormMixin):
try: try:
user = User.objects.filter(id=int(request.GET['remove_user'])).first() user = User.objects.filter(id=int(request.GET['remove_user'])).first()
if user.id == request.user.id or request.user.is_in_group(settings.SITH_GROUP_SAS_ADMIN_ID): if user.id == request.user.id or request.user.is_in_group(settings.SITH_GROUP_SAS_ADMIN_ID):
r = PeoplePictureRelation.objects.filter(user=user, picture=self.object).delete() PeoplePictureRelation.objects.filter(user=user, picture=self.object).delete()
except: except:
pass pass
if 'ask_removal' in request.GET.keys(): if 'ask_removal' in request.GET.keys():

View File

@ -117,12 +117,12 @@ class TrombiUser(models.Model):
else: else:
end_date = "" end_date = ""
TrombiClubMembership( TrombiClubMembership(
user=self, user=self,
club=str(m.club), club=str(m.club),
role=role[:64], role=role[:64],
start=get_semester(m.start_date), start=get_semester(m.start_date),
end=end_date, end=end_date,
).save() ).save()
class TrombiComment(models.Model): class TrombiComment(models.Model):
@ -140,6 +140,7 @@ class TrombiComment(models.Model):
return False return False
return user.id == self.author.user.id or user.can_edit(self.author.trombi) return user.id == self.author.user.id or user.can_edit(self.author.trombi)
class TrombiClubMembership(models.Model): class TrombiClubMembership(models.Model):
""" """
This represent a membership to a club This represent a membership to a club

View File

@ -43,4 +43,3 @@ urlpatterns = [
url(r'^membership/(?P<membership_id>[0-9]+)/edit$', UserTrombiEditMembershipView.as_view(), name='edit_membership'), url(r'^membership/(?P<membership_id>[0-9]+)/edit$', UserTrombiEditMembershipView.as_view(), name='edit_membership'),
url(r'^membership/(?P<membership_id>[0-9]+)/delete$', UserTrombiDeleteMembershipView.as_view(), name='delete_membership'), url(r'^membership/(?P<membership_id>[0-9]+)/delete$', UserTrombiDeleteMembershipView.as_view(), name='delete_membership'),
] ]

View File

@ -24,9 +24,9 @@
from django.http import Http404 from django.http import Http404
from django.shortcuts import get_object_or_404, redirect from django.shortcuts import get_object_or_404, redirect
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse_lazy, reverse
from django.views.generic import DetailView, RedirectView, TemplateView from django.views.generic import DetailView, RedirectView, TemplateView
from django.views.generic.edit import UpdateView, CreateView from django.views.generic.edit import UpdateView, CreateView, DeleteView
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django import forms from django import forms
from django.conf import settings from django.conf import settings
@ -50,17 +50,17 @@ class TrombiTabsMixin(TabedViewMixin):
tab_list.append({ tab_list.append({
'url': reverse('trombi:user_tools'), 'url': reverse('trombi:user_tools'),
'slug': 'tools', 'slug': 'tools',
'name': _("Tools"), 'name': _("Tools"),
}) })
tab_list.append({ tab_list.append({
'url': reverse('trombi:profile'), 'url': reverse('trombi:profile'),
'slug': 'profile', 'slug': 'profile',
'name': _("My profile"), 'name': _("My profile"),
}) })
tab_list.append({ tab_list.append({
'url': reverse('trombi:pictures'), 'url': reverse('trombi:pictures'),
'slug': 'pictures', 'slug': 'pictures',
'name': _("My pictures"), 'name': _("My pictures"),
}) })
try: try:
trombi = self.request.user.trombi_user.trombi trombi = self.request.user.trombi_user.trombi
@ -254,10 +254,11 @@ class UserTrombiEditProfileView(QuickNotifMixin, TrombiTabsMixin, UpdateView):
form_class = modelform_factory(User, form_class = modelform_factory(User,
fields=['second_email', 'phone', 'department', 'dpt_option', fields=['second_email', 'phone', 'department', 'dpt_option',
'quote', 'parent_address'], 'quote', 'parent_address'],
labels={'second_email': _("Personal email (not UTBM)"), labels={
'phone': _("Phone"), 'second_email': _("Personal email (not UTBM)"),
'parent_address': _("Native town"), 'phone': _("Phone"),
}) 'parent_address': _("Native town"),
})
template_name = "trombi/edit_profile.jinja" template_name = "trombi/edit_profile.jinja"
current_tab = "profile" current_tab = "profile"