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
Hunter T Jozwiak
whats-open
Commits
ffc90083
Commit
ffc90083
authored
Jun 23, 2017
by
David Haynes
Browse files
First pass on food tags for facilities
- using some great libs - it just works - needs docs
parent
676555d8
Changes
5
Hide whitespace changes
Inline
Side-by-side
requirements/base.txt
View file @
ffc90083
...
...
@@ -4,4 +4,7 @@ django-cas-client==1.3.0
djangorestframework==3.6.3
django-model-utils==3.0.0
mysqlclient==1.3.10
setuptools==36.0.1
\ No newline at end of file
setuptools==36.0.1
django-taggit==0.22.0
django-taggit-serializer==0.1.5
six
\ No newline at end of file
whats-open/api/admin.py
View file @
ffc90083
...
...
@@ -28,7 +28,7 @@ class FacilityAdmin(admin.ModelAdmin):
fieldsets
=
(
(
None
,
{
'fields'
:
(
'name'
,
'facility_category'
,
'facility_location'
,
'main_schedule'
,
'special_schedules'
,
'main_schedule'
,
'special_schedules'
,
'tags'
,
'tapingo_url'
,
'owners'
),
}),
)
...
...
whats-open/api/models.py
View file @
ffc90083
...
...
@@ -21,6 +21,7 @@ from django.core.validators import RegexValidator
# Other Imports
from
model_utils.models
import
TimeStampedModel
from
autoslug
import
AutoSlugField
from
taggit.managers
import
TaggableManager
class
Category
(
TimeStampedModel
):
"""
...
...
@@ -108,6 +109,7 @@ class Facility(TimeStampedModel):
tapingo_url
=
models
.
URLField
(
blank
=
True
,
validators
=
[
RegexValidator
(
regex
=
'^https:\/\/www.tapingo.com\/'
,
message
=
'The link is not a valid tapingo link. Example: https://www.tapingo.com/order/restaurant/starbucks-gmu-johnson/'
,
code
=
'invalid_tapingo_url'
)])
tags
=
TaggableManager
()
def
is_open
(
self
):
"""
...
...
whats-open/api/serializers.py
View file @
ffc90083
...
...
@@ -15,6 +15,8 @@ from .models import Category, Facility, Schedule, OpenTime, Location, Alert
# Other Imports
from
rest_framework
import
serializers
from
taggit_serializer.serializers
import
(
TagListSerializerField
,
TaggitSerializer
)
class
AlertSerializer
(
serializers
.
ModelSerializer
):
"""
...
...
@@ -85,9 +87,12 @@ class FacilitySerializer(serializers.HyperlinkedModelSerializer):
# Append a serialized Schedule object to represent special_schedules
special_schedules
=
ScheduleSerializer
(
many
=
True
,
read_only
=
True
)
tags
=
TagListSerializerField
()
class
Meta
:
# Choose the model to be serialized
model
=
Facility
# List the fields that we are serializing
fields
=
(
'id'
,
'facility_category'
,
'facility_location'
,
'tapingo_url'
,
'main_schedule'
,
'special_schedules'
,
'modified'
,
'name'
)
fields
=
(
'id'
,
'facility_category'
,
'facility_location'
,
'tags'
,
'tapingo_url'
,
'main_schedule'
,
'special_schedules'
,
'modified'
,
'name'
)
whats-open/settings/base.py
View file @
ffc90083
...
...
@@ -225,6 +225,10 @@ INSTALLED_APPS = (
# Apps specific for this project go here.
'api'
,
'rest_framework'
,
# Third party apps
'taggit'
,
'taggit_serializer'
)
########## END APP CONFIGURATION
...
...
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