-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue use ser prefered language Some fixes support translating password reset email Use custom password form in the view
- Loading branch information
Showing
7 changed files
with
77 additions
and
3 deletions.
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,3 +1,3 @@ | ||
__version__ = '1.4.2' | ||
__version__ = '1.4.3' | ||
|
||
default_app_config = 'accountsplus.apps.AccountsConfig' |
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,27 @@ | ||
from __future__ import unicode_literals | ||
import django.utils.timezone | ||
from django.utils.deprecation import MiddlewareMixin | ||
from django.utils import translation | ||
|
||
|
||
class TimezoneMiddleware(MiddlewareMixin): | ||
|
||
def process_request(self, request): | ||
if request.user.is_authenticated() and request.user.timezone: | ||
django.utils.timezone.activate(request.user.timezone) | ||
else: | ||
django.utils.timezone.deactivate() | ||
|
||
|
||
class UserLanguageMiddleware(MiddlewareMixin): | ||
|
||
# Update user preferred language each time a request has a new language and activate translation for that user. | ||
# Should be added after LocaleMiddleware as it depends on having request.LANGUAGE_CODE configured there. | ||
def process_request(self, request): | ||
user = request.user | ||
if not user.preferred_language: | ||
user.preferred_language = request.LANGUAGE_CODE | ||
user.save() | ||
else: | ||
translation.activate(user.preferred_language) | ||
request.LANGUAGE_CODE = translation.get_language() |
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