Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
whats-open
Commits
673344aa
Commit
673344aa
authored
Mar 04, 2014
by
Benjamin S Waters
Browse files
created custom login view need to integrate with cas
parent
a9f5bffc
Changes
2
Show whitespace changes
Inline
Side-by-side
management/views.py
View file @
673344aa
from
django.http
import
Http404
from
django.shortcuts
import
render_to_response
from
django.contrib.auth
import
authenticate
,
login
def
index
(
request
):
return
render_to_response
(
'management/index.html'
)
def
login
(
requets
):
def
login
(
request
):
username
=
request
.
POST
[
'username'
]
password
=
request
.
POST
[
'password'
]
user
=
authenticate
(
username
=
username
,
password
=
password
)
if
user
is
not
None
:
if
user
.
is_active
and
user
.
is_staff
:
login
(
request
,
user
)
return
render_to_response
(
'management/index.html'
)
else
:
return
render_to_response
(
'403.html'
)
else
:
return
render_to_response
(
'management/login.html'
)
website/models.py
View file @
673344aa
...
...
@@ -100,10 +100,10 @@ class OpenTime(TimeStampedModel):
thursday_end
=
models
.
TimeField
()
friday_start
=
models
.
TimeField
()
friday_end
=
models
.
TimeField
()
saturday_start
=
models
.
TimeField
()
saturday_end
=
models
.
TimeField
()
sunday_start
=
models
.
TimeField
()
sunday_end
=
models
.
TimeField
()
saturday_start
=
models
.
TimeField
(
blank
=
True
,
null
=
True
)
saturday_end
=
models
.
TimeField
(
blank
=
True
,
null
=
True
)
sunday_start
=
models
.
TimeField
(
blank
=
True
,
null
=
True
)
sunday_end
=
models
.
TimeField
(
blank
=
True
,
null
=
True
)
def
isOpenNow
(
self
):
"""Return true if the current time is this OpenTime's range"""
...
...
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