-
Notifications
You must be signed in to change notification settings - Fork 15
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
Added some APIs and fixed some bugs #86
base: master
Are you sure you want to change the base?
Changes from 15 commits
4f87951
d7a8782
08aaacf
5a88e27
7fcc15f
e920c9b
7cdcb7c
52c9632
55b0a55
cce5179
ed4dd3d
99c90d9
e3b88fc
e87d868
24c638f
3f35c7b
a567da8
3a43743
2abe379
e70449b
ff45062
bdb0ffc
cc05ad7
03d5fe6
b4e376d
17b7a56
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 |
---|---|---|
|
@@ -59,6 +59,7 @@ def get_secret(setting, secrets=secrets): | |
'bookmark.apps.BookmarkConfig', | ||
'tokens.apps.TokensConfig', | ||
'rest_framework', | ||
'corsheaders', | ||
] | ||
|
||
REST_FRAMEWORK = { | ||
|
@@ -71,14 +72,22 @@ def get_secret(setting, secrets=secrets): | |
CSRF_COOKIE_SECURE = True | ||
|
||
MIDDLEWARE = [ | ||
|
||
'django.middleware.security.SecurityMiddleware', | ||
'django.contrib.sessions.middleware.SessionMiddleware', | ||
'corsheaders.middleware.CorsMiddleware', | ||
'django.middleware.common.CommonMiddleware', | ||
'django.middleware.csrf.CsrfViewMiddleware', | ||
'django.contrib.auth.middleware.AuthenticationMiddleware', | ||
'django.contrib.messages.middleware.MessageMiddleware', | ||
'django.middleware.clickjacking.XFrameOptionsMiddleware', | ||
|
||
] | ||
CORS_ORIGIN_ALLOW_ALL = True | ||
|
||
CORS_ORIGIN_WHITELIST = ( | ||
'http://localhost:3001', | ||
) | ||
|
||
ROOT_URLCONF = 'campusdiscussbackend.urls' | ||
|
||
|
@@ -105,15 +114,17 @@ def get_secret(setting, secrets=secrets): | |
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases | ||
|
||
DATABASES = { | ||
"default": { | ||
"ENGINE": "django.db.backends.postgresql_psycopg2", | ||
"NAME": "postgres", | ||
"USER": "vikrant", | ||
"PASSWORD": get_secret("DB_PASSWORD"), | ||
'HOST': 'localhost', | ||
'default': { | ||
'ENGINE': 'django.db.backends.postgresql', | ||
'NAME': 'mydb', | ||
'USER': 'postgres', | ||
'PASSWORD': 'password', | ||
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. Please change the password field back to the previous manner. |
||
'HOST': '127.0.0.1', | ||
'PORT': '5432', | ||
} | ||
} | ||
|
||
#EXPO_SERVER="http://127.0.0.1:8080/" | ||
EXPO_SERVER="https://server.com" | ||
|
||
# Password validation | ||
|
@@ -162,5 +173,6 @@ def get_secret(setting, secrets=secrets): | |
# https://docs.djangoproject.com/en/1.11/howto/static-files/ | ||
|
||
STATIC_URL = '/static/' | ||
DEFAULT_AUTO_FIELD='django.db.models.AutoField' | ||
|
||
|
||
#APPEND_SLASH=False |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
""" | ||
|
||
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' | ||
EMAIL_HOST = 'mmtp.iitk.ac.in' | ||
EMAIL_HOST = 'smtp.gmail.com' | ||
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. Please configure it back to iitk webmail configurations. 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. Done |
||
EMAIL_USE_TLS = True | ||
EMAIL_PORT = 25 | ||
EMAIL_HOST_USER = '' | ||
|
@@ -12,6 +12,7 @@ | |
EMAIL_SUBJECT = { | ||
"Activation": "Activation mail for Campus Discuss", | ||
"PasswordReset": "Password Reset Email For Campus Discuss", | ||
"ForgotPass" : "Forgot Password mail for Campus Discuss" | ||
} | ||
EMAIL_BODY = { | ||
"Activation": """Hi {name:s}! | ||
|
@@ -20,12 +21,18 @@ | |
"PasswordReset": """Hi {name:s}! | ||
Click on the followiing link or copy-paste it to continue with the password reset procedure. | ||
{link:s}.""", | ||
"ForgotPass" : """Hi {name:s}! | ||
Click on the following link or copy-paste it to continue with setting new password for your account. | ||
{link:s}""" | ||
} | ||
REDIRECT_LINK = { | ||
"Activation": "http://127.0.0.1:8000/", | ||
"PasswordReset": "/", | ||
"ForgotPass" : "/" | ||
} | ||
EMAIL_LINK = { | ||
"Activation":"http://127.0.0.1:8000/users/verify/code={code:s}/", | ||
"Activation":"http://127.0.0.1:8000/users/register/verify/code={code:s}/", | ||
"PasswordReset": "http://127.0.0.1:8000/users/resetpass/code={code:s}/", | ||
"ForgotPass" : "http://127.0.0.1:8000/users/forgotpass/code={code:s}/", | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ def post(self,request): | |
content = request.data['content'] | ||
try: | ||
post = Post.objects.get(pk=post_id) | ||
except post.DoesNotExist: | ||
except Post.DoesNotExist: | ||
return Response(status=status.HTTP_404_NOT_FOUND) | ||
try: | ||
parent_id = request.data['parent_id'] | ||
|
@@ -46,7 +46,7 @@ def recursiveDelete(comment): | |
|
||
class DeleteComment(APIView): | ||
|
||
def delete(self, request): | ||
def post(self, request): | ||
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. This should be a delete request instead of a post request because you are deleting the comments. |
||
try: | ||
user = IsLoggedIn(request) | ||
if user is None: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,7 @@ def post(self, request): | |
|
||
class DeletePostView(APIView): | ||
|
||
def delete(self, request): | ||
def post(self, request): | ||
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. Same here also. |
||
user = IsLoggedIn(request) | ||
if user is not None: | ||
try: | ||
|
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.
Was this done to solve the cors issue with the frontend? If that was only the purpose, then remove this.