Commit 2fb7ca6d by Őry Máté

school: debug

parent 6b11b854
...@@ -54,14 +54,14 @@ def login(request): ...@@ -54,14 +54,14 @@ def login(request):
else: else:
attended = attended.split(';') attended = attended.split(';')
for c in attended: for c in attended:
co = Course.objects.get_or_create(code=c) co, created = Course.objects.get_or_create(code=c)
g = co.get_or_create_default_group() g = co.get_or_create_default_group()
if p.course_groups.filter(semester=sem, course=co).count() == 0: if p.course_groups.filter(semester=sem, course=co).count() == 0:
try: try:
p.course_groups.add(g) p.course_groups.add(g)
messages.info(request, _('Course "%s" added.') % g.course) messages.info(request, _('Course "%s" added.') % g.course)
except: except Exception as e:
pass logger.warning("Django ex %s" % e)
except ValidationError: except ValidationError:
pass pass
...@@ -71,14 +71,15 @@ def login(request): ...@@ -71,14 +71,15 @@ def login(request):
else: else:
held = held.split(';') held = held.split(';')
for c in held: for c in held:
co = Course.objects.get_or_create(code=c) co, created = Course.objects.get_or_create(code=c)
g = co.get_or_create_default_group() g = co.get_or_create_default_group()
try: try:
co.owners.add(p) co.owners.add(p)
g.owners.add(p) g.owners.add(p)
messages.info(request, _('Course "%s" ownership added.') % g.course) messages.info(request, _('Course "%s" ownership added.') % g.course)
except: except Exception as e:
pass logger.warning("Django ex %s" % e)
p.save() p.save()
user.backend = 'django.contrib.auth.backends.ModelBackend' user.backend = 'django.contrib.auth.backends.ModelBackend'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment