Skip to content

Commit

Permalink
django rest framework install and create image Serializers
Browse files Browse the repository at this point in the history
  • Loading branch information
shing100 committed Jul 29, 2018
1 parent 6d1b3d3 commit f90db23
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,6 @@ king_cats = king.cat_set.all()

> Basic RESTful API Design guidelines
- https://hackernoon.com/restful-api-designing-guidelines-the-best-practices-60e1d954e7c9
- https://hackernoon.com/restful-api-designing-guidelines-the-best-practices-60e1d954e7c9
- https://www.django-rest-framework.org

2 changes: 1 addition & 1 deletion config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
'allauth',
'allauth.account',
'allauth.socialaccount',
'rest_framework',
'rest_framework', # REST Framework
]
LOCAL_APPS = [
'limstagram.users.apps.UsersAppConfig',
Expand Down
20 changes: 20 additions & 0 deletions limstagram/images/serializers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from rest_framework import serializers
from . import models

class ImageSerializer(serializers.Serializer):

class Meta:
model = models.Image
fields = '__all__'

class CommentSerializer(serializers.Serializer):

class Meta:
model = models.Comment
fidels = '__all__'

class LikeSerializer(serializers.Serializer):

class Meta:
models = models.Like
fields = '__all__'
11 changes: 11 additions & 0 deletions limstagram/images/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from django.conf.urls import url
from . import views

app_name = "images"
urlpatterns = [
url(
regex=r'^all/$',
view=views.ListAllImages.as_view(),
name='all_images'
)
]

0 comments on commit f90db23

Please sign in to comment.