Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add django rest api * add .DS_STORE to .gitignore * move api into new project structure * admin page * fix syntax of line
- Loading branch information
Showing
10 changed files
with
54 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ __pycache__/ | |
__pycache__ | ||
db.sqlite3 | ||
media | ||
.DS_Store | ||
|
||
# Backup files # | ||
*.bak | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
from django.contrib import admin | ||
|
||
from .models import Agency,Entry | ||
# Register your models here. | ||
admin.site.register(Agency) | ||
admin.site.register(Entry) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from rest_framework import serializers | ||
from apps.civic_pulse.models import Agency, Entry | ||
|
||
|
||
class AgencySerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = Agency | ||
fields = ['id','name','website','twitter','facebook','phone_number','address','description','last_successful_scrape','scrape_counter'] | ||
|
||
|
||
class EntrySerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = Entry | ||
fields = ['agency','https_enabled','has_privacy_policy','mobile_friendly','good_performance','has_social_media','has_contact_info'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from rest_framework import viewsets | ||
|
||
from apps.civic_pulse.api.serializers import AgencySerializer,EntrySerializer | ||
from apps.civic_pulse.models import Agency, Entry | ||
|
||
|
||
class AgencyViewSet(viewsets.ModelViewSet): | ||
queryset = Agency.objects.all() | ||
serializer_class = AgencySerializer | ||
|
||
|
||
class EntryViewSet(viewsets.ModelViewSet): | ||
queryset = Entry.objects.all() | ||
serializer_class = EntrySerializer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters