Skip to content

Instantly share code, notes, and snippets.

Arulmurugan Rajaraman arulmr

Block or report user

Report or block arulmr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@arulmr
arulmr / activate_timezone.py
Last active Aug 16, 2017
Getting user timezone from IP in Django
View activate_timezone.py
import pytz
from django.utils import timezone
....
timezone.activate(pytz.timezone(user_time_zone))
@arulmr
arulmr / mail.py
Last active Oct 28, 2015
Django mail settings
View mail.py
# EMAIL Server config
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = '587'
EMAIL_HOST_USER = 'example@gmail.com'
EMAIL_HOST_PASSWORD = 'somepassword'
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = 'example@gmail.com'
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
@arulmr
arulmr / admin.py
Last active Dec 22, 2015
Django 1.5 - Custom User Models
View admin.py
from django.contrib import admin
from django.contrib.auth.models import Group
from django.contrib.auth.admin import UserAdmin
class UserProfileAdmin(UserAdmin):
form = UserChangeForm
add_form = UserCreationForm
list_display = ('email', 'mobile', 'is_superuser')
list_filter = ('is_superuser',)
@arulmr
arulmr / admin.py
Last active Dec 20, 2015
Auto Complete in Django Admin
View admin.py
class BlockAdmin(NoLookupsForeignKeyAutocompleteAdmin, admin.ModelAdmin):
related_search_fields = {
'city' : ('name', 'state__name', ),
}
You can’t perform that action at this time.