django-sundial 1.0.3
pip install django-sundial==1.0.3
Newer version available (1.1.1)
Released:
Django application providing database, form fields and middleware for timezone support.
Navigation
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: MIT License (MIT)
- Author: Simon Charette.
- Tags django, timezone
Classifiers
- Development Status
- Environment
- Framework
- Intended Audience
- License
- Operating System
- Programming Language
- Topic
Project description
Django application providing database, form fields and middleware for timezone support.
Installation
pip install django-sundial
Usage
# settings.py
TIME_ZONE = 'America/Chicago'
AUTH_USER_MODEL = 'app.User'
MIDDLEWARE = [
...,
'django.contrib.sessions.middleware.SessionMiddleware',
...,
'sundial.middleware.TimezoneMiddleware',
...,
]
# app/models.py
from django.conf import settings
from django.contrib.auth.models import AbstractUser
from django.contrib.auth.signals import user_logged_in
from django.dispatch.dispatcher import receiver
from sundial.fields import TimezoneField
from sundial.utils import set_session_timezone
from sundial.zones import COMMON_GROUPED_CHOICES
class User(AbstractUser):
timezone = TimezoneField(
default=settings.TIME_ZONE, choices=COMMON_GROUPED_CHOICES
)
@receiver(user_logged_in)
def assign_user_timezone(request, user, **kwargs):
set_session_timezone(request.session, user.timezone)
Project details
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: MIT License (MIT)
- Author: Simon Charette.
- Tags django, timezone
Classifiers
- Development Status
- Environment
- Framework
- Intended Audience
- License
- Operating System
- Programming Language
- Topic
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django-sundial-1.0.3.tar.gz
.
File metadata
- Download URL: django-sundial-1.0.3.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4155e6fb8407b26691d3322b1a479f973972e80cc9742581035113f85a29f05d |
|
MD5 | b083e52fe4672620833d01c53b4e3146 |
|
BLAKE2b-256 | e1b6880e959f79b5ac09dc3c0803c91998eb512787febbae5b1339eaa861623d |
File details
Details for the file django_sundial-1.0.3-py2.py3-none-any.whl
.
File metadata
- Download URL: django_sundial-1.0.3-py2.py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e465d31a3e68ba5988e9402008b96265a3b8e6da6d5174691187c6267298f09 |
|
MD5 | c94bad08c95157ee03a4bd4a78b9cf77 |
|
BLAKE2b-256 | 6ce1ab074ceaedfd216dc75154ec2e9d1986646d06f8a7c022da120675a77207 |