-
Notifications
You must be signed in to change notification settings - Fork 180
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
Initial commit: Added Trello URL in README.md #128
base: master
Are you sure you want to change the base?
Changes from all commits
9db78fc
07e76f1
ff7f381
020d6d3
3c629d4
6bbb17d
f4dfc19
22f9125
8768550
1db5c61
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"python.pythonPath": "C:\\Users\\telhu\\.virtualenvs\\Intro-Django-WLVi3cbh\\Scripts\\python.exe" | ||
} |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
from django.contrib import admin | ||
from django.urls import path, include | ||
from django.urls import path, include, re_path | ||
from django.conf.urls import include | ||
from rest_framework.authtoken import views | ||
|
||
urlpatterns = [ | ||
path('admin/', admin.site.urls), | ||
path('api/', include('api.urls')), | ||
path('api/adv/', include('adventure.urls')), | ||
re_path(r'^api-token-auth/', views.obtain_auth_token) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very nice how you implemented an authentication route here. |
||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,5 +63,16 @@ def move(request): | |
@csrf_exempt | ||
@api_view(["POST"]) | ||
def say(request): | ||
# IMPLEMENT | ||
return JsonResponse({'error':"Not yet implemented"}, safe=True, status=500) | ||
player = request.user.player | ||
player_name = player.user.username | ||
player_uuid = player.uuid | ||
player_id = player.id | ||
data = json.loads(request.body) | ||
message = data['message'] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a small thing, but have you thought about how you might handle the case where a user submits a blank message or a malicious code? It's definitely stretch but it could interesting to think about. |
||
|
||
pusher.trigger(f'p-channel-{player_uuid}', u'broadcast', {'name':f'{player_name}', 'message':f'{message}'}) | ||
|
||
return JsonResponse({'message':f"{player_name} says \'{message}\'"}, safe=True) | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Generated by Django 2.1.1 on 2018-12-10 22:23 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import uuid | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Player', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('currentRoom', models.IntegerField(default=0)), | ||
('uuid', models.UUIDField(default=uuid.uuid4, unique=True)), | ||
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='Room', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('title', models.CharField(default='DEFAULT TITLE', max_length=50)), | ||
('description', models.CharField(default='DEFAULT DESCRIPTION', max_length=500)), | ||
('n_to', models.IntegerField(default=0)), | ||
('s_to', models.IntegerField(default=0)), | ||
('e_to', models.IntegerField(default=0)), | ||
('w_to', models.IntegerField(default=0)), | ||
], | ||
), | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
from django.conf.urls import url | ||
from . import api | ||
from rest_framework.authtoken import views | ||
from django.urls import path, include, re_path | ||
|
||
urlpatterns = [ | ||
url('init', api.initialize), | ||
url('move', api.move), | ||
url('say', api.say), | ||
#re_path(r'^api-token-auth/', views.obtain_auth_token) | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
from django.urls import include, path | ||
from django.urls import include, path, re_path | ||
from django.conf.urls import url | ||
from rest_framework.authtoken import views | ||
|
||
urlpatterns = [ | ||
path('', include('rest_auth.urls')), | ||
path('registration/', include('rest_auth.registration.urls')), | ||
# re_path(r'^api-token-auth/', views.obtain_auth_token) | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,35 @@ | ||
asn1crypto==0.24.0 | ||
certifi==2018.8.24 | ||
astroid==2.1.0 | ||
bokeh==1.0.1 | ||
certifi==2018.11.29 | ||
cffi==1.11.5 | ||
chardet==3.0.4 | ||
cryptography==2.3.1 | ||
defusedxml==0.5.0 | ||
dj-database-url==0.5.0 | ||
Django==2.1.1 | ||
django-allauth==0.37.1 | ||
django-cors-headers==2.4.0 | ||
django-heroku==0.3.1 | ||
django-rest-api==0.1.5 | ||
django-rest-auth==0.9.3 | ||
djangorestframework==3.8.2 | ||
gunicorn==19.9.0 | ||
idna==2.7 | ||
colorama==0.4.1 | ||
cryptography==2.4.2 | ||
idna==2.8 | ||
isort==4.3.4 | ||
Jinja2==2.10 | ||
lazy-object-proxy==1.3.1 | ||
MarkupSafe==1.1.0 | ||
mccabe==0.6.1 | ||
ndg-httpsclient==0.5.1 | ||
oauthlib==2.1.0 | ||
psycopg2==2.7.5 | ||
pusher==2.0.1 | ||
numpy==1.15.4 | ||
packaging==18.0 | ||
Pillow==5.3.0 | ||
pipenv==2018.11.26 | ||
pusher==2.0.2 | ||
pyasn1==0.4.4 | ||
pycparser==2.19 | ||
pylint==2.2.0 | ||
pyOpenSSL==18.0.0 | ||
python-decouple==3.1 | ||
python3-openid==3.1.0 | ||
pytz==2018.5 | ||
requests==2.19.1 | ||
requests-oauthlib==1.0.0 | ||
pyparsing==2.3.0 | ||
python-dateutil==2.7.5 | ||
pytz==2018.7 | ||
PyYAML==3.13 | ||
requests==2.21.0 | ||
six==1.11.0 | ||
urllib3==1.23 | ||
whitenoise==4.1 | ||
tornado==5.1.1 | ||
urllib3==1.24.1 | ||
virtualenv==16.1.0 | ||
virtualenv-clone==0.4.0 | ||
wrapt==1.10.11 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good that you put your trello link in here. It's a small thing but a lot of students forget to do this, but it's really important for communicating your work so great job.