Merge branch 'Evarin/enrol-json' into Qwann/calendar

This commit is contained in:
Daru13 2018-11-19 22:32:58 +01:00
commit d3e1943021
4 changed files with 9 additions and 3 deletions

View file

@ -5,6 +5,7 @@ from equipment.models import EquipmentAttribution
class EquipmentAttributionExtraInline(admin.TabularInline): class EquipmentAttributionExtraInline(admin.TabularInline):
autocomplete_fields = ['equipment', ]
model = EquipmentAttribution model = EquipmentAttribution
extra = 0 extra = 0
classes = ['collapse'] classes = ['collapse']

View file

@ -65,6 +65,12 @@ class EnrolActivityView(LoginRequiredMixin, View):
else: else:
success = False success = False
if "ajax" in request.GET: if "ajax" in request.GET:
if request.GET["ajax"] == "json":
enrols = activity.staff
return JsonResponse({
"enrolled": enrols.filter(id=request.user.id).exists(),
"number": enrols.count(),
})
return render(request, "event/activity_summary.html", return render(request, "event/activity_summary.html",
{"activity": activity}) {"activity": activity})
return HttpResponseRedirect(reverse("event:activity", kwargs={"pk":pk})) return HttpResponseRedirect(reverse("event:activity", kwargs={"pk":pk}))

View file

@ -214,4 +214,4 @@ SOCIALACCOUNT_PROVIDERS = {
ACCOUNT_ADAPTER = 'shared.allauth_adapter.AccountAdapter' ACCOUNT_ADAPTER = 'shared.allauth_adapter.AccountAdapter'
SOCIALACCOUNT_ADAPTER = 'shared.allauth_adapter.SocialAccountAdapter' SOCIALACCOUNT_ADAPTER='allauth_ens.adapter.LongTermClipperAccountAdapter'

View file

@ -7,8 +7,7 @@ django-allauth==0.36.0
django-allauth-cas==1.0.0b2 django-allauth-cas==1.0.0b2
django-tables2==2.0.0a2 django-tables2==2.0.0a2
django-filter==2.0.0 django-filter==2.0.0
#git+https://git.eleves.ens.fr/cof-geek/django-allauth-ens@6e77b31e0dfed7659776d django-allauth-ens
git+https://git.eleves.ens.fr/cof-geek/django-allauth-ens@30a072b7db1fc2d4652284227a3e7e876b14c915
django-bootstrap-form==3.4 django-bootstrap-form==3.4
drf-nested-routers==0.90.0 drf-nested-routers==0.90.0
django-notifications==0.1.dev0 django-notifications==0.1.dev0