Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Django Channels + React along with API translation #46

Merged
merged 39 commits into from Jul 6, 2017

Conversation

AvaisP
Copy link
Member

@AvaisP AvaisP commented Jun 26, 2017

No description provided.

let socket = this.socket;
socket.send(
JSON.stringify({
event: "fetchcurrentport"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change fetchcurrentport to fetchCurrentPort? Basically please follow the camel casing.

README.md Outdated
@@ -0,0 +1,52 @@
# Origami Webapp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change it to Origami only.

README.md Outdated
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)


## Development Setup instructions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace with ## Development setup instructions

README.md Outdated

**This application requires node v5+ and Python 2.7/3.4+**

### Create a Virtual Environment:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace with ### Create a Virtual Environment

api/consumers.py Outdated


def ws_disconnect(message):
print (message.content)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please remove the debug statement here?

api/views.py Outdated
demo = Demo.objects.get(id=demo_id)
base_comp_id = body["baseComponentId"]
props = []
for prop in body["props"]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use serializers to serialize the data.

api/views.py Outdated
try:
component = model.objects.get(userid=userid, demo=demo)
except Exception as e:
return JsonResponse({})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please send a json to frontend instead of blank dict.

api/views.py Outdated
coverImage=coverImage, terminal=terminal, timestamp=timestamp,
token=token, status=status)
serialize = DemoSerializer(demo)
return JsonResponse(serialize.data)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return a Response() object.

api/views.py Outdated
demo.footerMessage = body["footerMessage"]
demo.coverImage = body["coverImage"]
demo.terminal = body["terminal"]
#demo.timestamp = body["timestamp"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this.

api/views.py Outdated
return HttpResponse("Invalid URL")


def getpermalink(request, shorturl):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace with get_permalink

tmp.save()
acc.user = tmp
acc.save()
return HttpResponseRedirect('/login?status=passed&token=' + token.token + '&username=' + tmp.username + '&user_id=' + str(tmp.id))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of hardcoding the URL like /login, can we use the name of the URL here using reverse()?

channel_routing = [
route("websocket.connect", ws_connect),
route("websocket.receive", ws_message),
]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a newline here.

@AvaisP AvaisP merged commit df98e89 into django-react Jul 6, 2017
@AvaisP AvaisP deleted the socket-translate-api branch September 19, 2017 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants