Skip to content

[Error] Fix 404 on /resources/comments/ by redirecting GET requests to /posted/ (Closes #223) #268

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

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions TRM/settings_local_development.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'TRM_local', # Or path to database file if using sqlite3.
'USER': 'root', # Not used with sqlite3.
'PASSWORD': '1234', # Not used with sqlite3.
'USER': 'TRM_USER', # Not used with sqlite3.
'PASSWORD': 'pass', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
Expand Down
4 changes: 3 additions & 1 deletion TRM/subdomain_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
from TRM import settings
# from django.views.generic.simple import direct_to_template
from companies.views import upload_vacancy_file, delete_vacancy_file
from TRM.views import custom_logout_view
from django.shortcuts import redirect
from TRM.views import custom_logout_view, comments_entrypoint

admin.autodiscover()
handler500 = 'TRM.views.handler500'
Expand All @@ -44,6 +45,7 @@
path('contact/', TRM_views.contact, name="contact"),
path('comingsoon/', TRM_views.comingsoon, name="comingsoon"),
path('jobs/', TRM_views.job_board, name="job_board"),
path('resources/comments/', comments_entrypoint),
Copy link
Contributor

Choose a reason for hiding this comment

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

what is this for?

path('resources/comments/', include('django_comments.urls')),
# url(r'resources/', include('zinnia.urls')),
# url(r'help/', include('helpdesk.urls')),
Expand Down
9 changes: 9 additions & 0 deletions TRM/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
from utils import is_ajax
from django.contrib.auth.views import LogoutView
from django.contrib.auth import logout
from django.shortcuts import redirect
from django.http import HttpResponseNotAllowed
from django_comments.views.comments import comment_done

def index(request):
if request.method == 'POST':
Expand Down Expand Up @@ -260,3 +263,9 @@ def custom_logout_view(request):
if request.user.is_authenticated:
logout(request)
return redirect('/')


def comments_entrypoint(request):
if request.method == 'GET':
return comment_done(request)
return None
2 changes: 1 addition & 1 deletion companies/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ def vacancies_summary(request, vacancy_status_name=None):
if not subdomain_data['active_subdomain']:
raise Http404
# company = get_object_or_404(Company, user=request.user)
if request.user.is_authenticated and getattr(getattr(request.user, 'profile', None), 'codename', None)
if request.user.is_authenticated and getattr(getattr(request.user, 'profile', None), 'codename', None):
#if request.user.is_authenticated and request.user.profile.codename == 'recruiter
try:
recruiter = Recruiter.objects.get(user=request.user, user__is_active=True)
Expand Down