Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
d7119c30
authored
Feb 03, 2013
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
school: handle neptun data
refs
#30
parent
9174fc13
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
school/views.py
+28
-0
No files found.
school/views.py
View file @
d7119c30
from
datetime
import
datetime
from
datetime
import
datetime
from
django.core.exceptions
import
ValidationError
from
django.conf
import
settings
from
django.conf
import
settings
from
django.contrib.auth.decorators
import
login_required
from
django.contrib.auth.decorators
import
login_required
from
django.contrib.auth.models
import
User
from
django.contrib.auth.models
import
User
...
@@ -41,7 +42,34 @@ def login(request):
...
@@ -41,7 +42,34 @@ def login(request):
user
.
last_name
=
request
.
META
[
'sn'
]
user
.
last_name
=
request
.
META
[
'sn'
]
user
.
email
=
request
.
META
[
'email'
]
user
.
email
=
request
.
META
[
'email'
]
user
.
save
()
user
.
save
()
p
,
created
=
Person
.
objects
.
get_or_create
(
user
=
user
)
try
:
sem
=
Semester
.
get_current
()
for
c
in
request
.
META
[
'HTTP_NIIFEDUPERSONATTENDEDCOURSE'
]
.
split
(
';'
):
co
=
Course
.
objects
.
get_or_create
(
code
=
c
)
g
=
co
.
get_or_create_default_group
()
if
p
.
course_groups
.
filter
(
semester
=
sem
,
course
=
co
)
.
count
()
==
0
:
try
:
p
.
course_groups
.
add
(
g
)
messages
.
info
(
request
,
_
(
'Course "
%
s" added.'
)
%
g
.
course
)
except
:
pass
except
ValidationError
:
pass
for
c
in
request
.
META
[
'HTTP_NIIFEDUPERSONHELDCOURSE'
]
.
split
(
';'
):
co
=
Course
.
objects
.
get_or_create
(
code
=
c
)
g
=
co
.
get_or_create_default_group
()
try
:
co
.
owners
.
add
(
p
)
g
.
owners
.
add
(
p
)
messages
.
info
(
request
,
_
(
'Course "
%
s" ownership added.'
)
%
g
.
course
)
except
:
pass
p
.
save
()
user
.
backend
=
'django.contrib.auth.backends.ModelBackend'
user
.
backend
=
'django.contrib.auth.backends.ModelBackend'
auth
.
login
(
request
,
user
)
auth
.
login
(
request
,
user
)
logger
.
warning
(
"Shib login with
%
s"
%
request
.
META
)
logger
.
warning
(
"Shib login with
%
s"
%
request
.
META
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment