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
roomlist
Commits
437812a4
Commit
437812a4
authored
Jan 12, 2015
by
Daniel W Bond
Browse files
removed address and added campus selector
parent
97f43875
Changes
1
Show whitespace changes
Inline
Side-by-side
roomlist/housing/models.py
View file @
437812a4
...
...
@@ -22,7 +22,19 @@ class Building(TimeStampedModel):
neighbourhood
=
models
.
CharField
(
max_length
=
100
,
choices
=
NEIGHBOURHOOD_CHOICES
,
default
=
NONE
)
address
=
models
.
ForeignKey
(
'Address'
)
#address = models.ForeignKey('Address')
PRINCE_WILLIAM
=
'pw'
MASONVALE
=
'mv'
FAIRFAX
=
'ff'
CAMPUS_CHOICES
=
(
(
NONE
,
'None'
),
(
PRINCE_WILLIAM
,
'Prince William'
),
(
MASONVALE
,
'mv'
),
(
FAIRFAX
,
'Fairfax'
),
)
campus
=
models
.
CharField
(
max_length
=
100
,
choices
=
CAMPUS_CHOICES
,
default
=
NONE
)
slug
=
AutoSlugField
(
populate_from
=
'name'
,
unique
=
True
)
...
...
@@ -45,18 +57,19 @@ class Room(TimeStampedModel):
def
__str__
(
self
):
# __unicode__ on Python 2
return
self
.
building
.
__str__
()
+
" "
+
self
.
number
.
__str__
()
class
Address
(
TimeStampedModel
):
# buildings on campus don't have separate addresses yet
#class Address(TimeStampedModel):
street
=
models
.
CharField
(
max_length
=
120
)
city
=
models
.
CharField
(
max_length
=
120
)
state
=
USStateField
()
zip_code
=
models
.
IntegerField
(
max_length
=
5
)
#
street = models.CharField(max_length=120)
#
city = models.CharField(max_length=120)
#
state = USStateField()
#
zip_code = models.IntegerField(max_length=5)
class
Meta
:
verbose_name_plural
=
'addresses'
#
class Meta:
#
verbose_name_plural = 'addresses'
def
__str__
(
self
):
# __unicode__ on Python 2
return
self
.
street
#
def __str__(self): # __unicode__ on Python 2
#
return self.street
class
Class
(
TimeStampedModel
):
year_int
=
models
.
IntegerField
()
...
...
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