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
6c2269a3
Commit
6c2269a3
authored
Oct 14, 2013
by
Renfred Harper
Browse files
Sort models alphabetically in admin
parent
9ef15a44
Changes
1
Hide whitespace changes
Inline
Side-by-side
website/models.py
View file @
6c2269a3
...
...
@@ -14,6 +14,10 @@ class Restaurant(BaseModel):
related_name
=
'restaurant_main'
)
special_schedules
=
models
.
ManyToManyField
(
'Schedule'
,
related_name
=
'restaurant_special'
,
null
=
True
,
blank
=
True
)
class
Meta
:
# Sort by name in admin view
ordering
=
[
'name'
]
def
isOpen
(
self
):
"""
...
...
@@ -55,7 +59,10 @@ class Schedule(BaseModel):
help_text
=
'Date that this schedule goes into effect'
)
valid_end
=
models
.
DateField
(
'End Date'
,
null
=
True
,
blank
=
True
,
help_text
=
'Last day that this schedule is in effect'
)
class
Meta
:
ordering
=
[
'name'
]
def
isOpenNow
(
self
):
"""Return true if this schedule is open right now."""
for
time
in
OpenTime
.
objects
.
filter
(
schedule
=
self
):
...
...
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