-
Notifications
You must be signed in to change notification settings - Fork 1
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
Support Django 2.0 #33
Open
waseem-omar
wants to merge
8
commits into
master
Choose a base branch
from
support_django_2.0
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5846d0e
Support Django 2.0
waseem-omar e2ff831
Update logout_then_login and password_reset views
waseem-omar e87496a
Fix UserAdmin unicode issue
waseem-omar d4ce111
Fix bug in is_masquerading
waseem-omar 82e95e2
Fix bug in is_masquerading
waseem-omar 99c45bf
Fix Masquerade column URL in users table
waseem-omar 9b04804
Update Masquerade views
waseem-omar 8bbd249
Update Masquerade views
waseem-omar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
from __future__ import unicode_literals | ||
|
||
from django.apps import AppConfig | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
from __future__ import unicode_literals | ||
import django.utils.timezone | ||
from django.utils.deprecation import MiddlewareMixin | ||
|
||
|
||
class TimezoneMiddleware(MiddlewareMixin): | ||
def process_request(self, request): | ||
if request.user.is_authenticated() and request.user.timezone: | ||
if request.user.is_authenticated and request.user.timezone: | ||
django.utils.timezone.activate(request.user.timezone) | ||
else: | ||
django.utils.timezone.deactivate() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +0,0 @@ | ||
from __future__ import unicode_literals | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
from __future__ import unicode_literals | ||
|
||
import django.test | ||
import django.contrib.admin | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
from __future__ import unicode_literals | ||
|
||
import django.test | ||
import django.core.mail | ||
import django.db.models | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
from __future__ import unicode_literals | ||
|
||
import django.test | ||
import django.test.utils | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
from __future__ import unicode_literals | ||
|
||
import django.test | ||
import django.shortcuts | ||
import django.conf.urls | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
from __future__ import unicode_literals | ||
|
||
import django.test | ||
import django.test.utils | ||
import django.test.client | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,29 @@ | ||
from __future__ import unicode_literals | ||
|
||
import django.conf.urls | ||
from django.contrib.auth.urls import url | ||
import django.contrib.auth.urls | ||
import django.contrib.auth.views | ||
|
||
import views | ||
import forms | ||
|
||
from accountsplus import views | ||
from accountsplus import forms | ||
|
||
urlpatterns = [ | ||
url(r'^logout/$', views.logout_then_login, name='logout'), | ||
url(r'^password_change/$', views.password_change, name='password_change'), | ||
url(r'^password_reset/$', views.password_reset, name='password_reset'), | ||
url(r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', | ||
django.contrib.auth.views.password_reset_confirm, name='password_reset_confirm'), | ||
django.conf.urls.url(r'^logout/$', views.logout_then_login, name='logout'), | ||
django.conf.urls.url(r'^password_change/$', views.password_change, name='password_change'), | ||
django.conf.urls.url(r'^password_reset/$', django.contrib.auth.views.PasswordResetView.as_view(), name='password_reset'), | ||
django.conf.urls.url(r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', | ||
django.contrib.auth.views.PasswordResetConfirmView.as_view(), name='password_reset_confirm'), | ||
|
||
# override the admin password reset flow to use the normal site password | ||
# reset flow | ||
url(r'^password_reset/$', views.password_reset, name='admin_password_reset'), | ||
django.conf.urls.url(r'^password_reset/$', views.password_reset, name='admin_password_reset'), | ||
|
||
url(r'^login/$', | ||
django.contrib.auth.views.login, | ||
django.conf.urls.url(r'^login/$', | ||
django.contrib.auth.views.LoginView.as_view(), | ||
kwargs={'authentication_form': forms.EmailBasedAuthenticationForm, 'redirect_authenticated_user': True}, | ||
name='login'), | ||
url(r'^', django.conf.urls.include(django.contrib.auth.urls)), | ||
django.conf.urls.url(r'^', django.conf.urls.include(django.contrib.auth.urls)), | ||
|
||
# masquerade views | ||
url(r'^admin/masquerade/end/$', views.end_masquerade, name='end_masquerade'), | ||
url(r'^admin/masquerade/(?P<user_id>\d+)/$', views.masquerade, name='masquerade'), | ||
django.conf.urls.url(r'^admin/masquerade/end/$', views.end_masquerade, name='end_masquerade'), | ||
django.conf.urls.url(r'^admin/masquerade/(?P<user_id>\d+)/$', views.masquerade, name='masquerade'), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
setuptools | ||
Django==1.10.1 | ||
Django==2.2.1 | ||
flake8 | ||
pep8 | ||
pyflakes | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
from __future__ import unicode_literals | ||
import os | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
from __future__ import unicode_literals | ||
|
||
import django.conf.urls | ||
import django.contrib.admin | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@waseem-omar I think we need to mark this as
SafeString
so that it appears as hyperlink in the tableThere 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.
Should look like this
django.utils.html.mark_safe('<a href="{}">sign in</a>'.format(django.urls.reverse('masquerade', kwargs={'user_id': obj.id})))
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.
Done @nasief, I have also refactored Masquerading views as you suggested above.