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
Christopher M Reffett
whats-open
Commits
784a388b
Commit
784a388b
authored
Sep 18, 2012
by
Tyler Hallada
Browse files
Removing caching. Removed unused imports.
parent
c7eeb800
Changes
3
Hide whitespace changes
Inline
Side-by-side
website/models.py
View file @
784a388b
from
django.db
import
models
from
django.core.cache
import
cache
import
datetime
...
...
@@ -11,14 +10,6 @@ class Restaurant(models.Model):
specialSchedules
=
models
.
ManyToManyField
(
'Schedule'
,
related_name
=
'restaurant_special'
,
null
=
True
,
blank
=
True
)
def
save
(
self
,
*
args
,
**
kwargs
):
cache
.
clear
()
# Invalidate cache on restaurant change/creation
super
(
Restaurant
,
self
).
save
(
*
args
,
**
kwargs
)
def
delete
(
self
,
*
args
,
**
kwargs
):
cache
.
clear
()
# Invalidate cache on restuarant deletion
super
(
Restaurant
,
self
).
delete
(
*
args
,
**
kwargs
)
def
isOpen
(
self
):
"""
Return true if this restaurant is currently open.
...
...
@@ -64,14 +55,6 @@ class Schedule(models.Model):
sunOpen
=
models
.
TimeField
(
null
=
True
,
blank
=
True
)
sunClose
=
models
.
TimeField
(
null
=
True
,
blank
=
True
)
def
save
(
self
,
*
args
,
**
kwargs
):
cache
.
clear
()
# Invalidate cache on schedule change/creation
super
(
Schedule
,
self
).
save
(
*
args
,
**
kwargs
)
def
delete
(
self
,
*
args
,
**
kwargs
):
cache
.
clear
()
# Invalidate cache on schedule deletion
super
(
Schedule
,
self
).
delete
(
*
args
,
**
kwargs
)
def
isOpenNow
(
self
):
"""Return true if this schedule is open right now."""
today
=
datetime
.
datetime
.
today
()
...
...
website/views.py
View file @
784a388b
from
website.models
import
Restaurant
,
Schedule
from
django.template
import
RequestContext
from
django.shortcuts
import
render_to_response
,
get_object_or_404
,
get_list_or_404
from
django.conf
import
settings
from
website.models
import
Restaurant
from
django.shortcuts
import
render_to_response
def
restaurant_grid
(
request
):
...
...
whats_open/settings.py
View file @
784a388b
...
...
@@ -23,14 +23,6 @@ DATABASES = {
}
}
CACHES
=
{
'default'
:
{
'BACKEND'
:
'django.core.cache.backends.memcached.MemcachedCache'
,
'LOCATION'
:
'127.0.0.1:11211'
,
'TIMOUT'
:
259200
,
}
}
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
...
...
@@ -99,9 +91,6 @@ TEMPLATE_LOADERS = (
)
MIDDLEWARE_CLASSES
=
(
'django.middleware.cache.UpdateCacheMiddleware'
,
'django.middleware.common.CommonMiddleware'
,
'django.middleware.cache.FetchFromCacheMiddleware'
,
'django.middleware.common.CommonMiddleware'
,
'django.contrib.sessions.middleware.SessionMiddleware'
,
'django.middleware.csrf.CsrfViewMiddleware'
,
...
...
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