Skip to content

Django Channels + React along with API translation#46

Merged
AvaisP merged 39 commits intodjango-reactfrom
socket-translate-api
Jul 6, 2017
Merged

Django Channels + React along with API translation#46
AvaisP merged 39 commits intodjango-reactfrom
socket-translate-api

Conversation

@AvaisP
Copy link
Copy Markdown
Member

@AvaisP AvaisP commented Jun 26, 2017

No description provided.

let socket = this.socket;
socket.send(
JSON.stringify({
event: "fetchcurrentport"
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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?

demo = Demo.objects.get(id=demo_id)
base_comp_id = body["baseComponentId"]
props = []
for prop in body["props"]:
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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),
] No newline at end of file
Copy link
Copy Markdown
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.

3 participants