Last active
August 29, 2015 13:55
-
-
Save AntelopeSalad/8722002 to your computer and use it in GitHub Desktop.
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
from django.contrib import admin | |
from leads.models import Lead | |
admin.site.register(Lead) |
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
from django.core.validators import MinLengthValidator | |
from django.db import models | |
from django.core.urlresolvers import reverse | |
from django.conf import settings | |
from core.abstract_models import BaseModel | |
class Lead(BaseModel): | |
STATUS = ( | |
(0, 'Open'), | |
(1, 'On hold'), | |
(2, 'Contacted'), | |
(3, 'Converted'), | |
(4, 'Disqualified'), | |
) | |
user = models.ForeignKey(settings.AUTH_USER_MODEL) | |
# a bunch of fields left out of this gist, nothing out of the ordinary | |
def __str__(self): | |
return '{0} {1}'.format(self.first_name, self.last_name) | |
def save(self, *args, **kwargs): | |
if self.value is None: | |
self.value = 0 | |
super().save(*args, **kwargs) | |
def get_absolute_url(self): | |
return reverse('leads:detail', args=[str(self.pk)]) |
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
import os | |
# ##################################################################################################################### | |
# DJANGO SETTINGS | |
# ##################################################################################################################### | |
SITE_ID = 1 | |
DEBUG = True | |
TEMPLATE_DEBUG = True | |
ALLOWED_HOSTS = [] | |
TIME_ZONE = 'UTC' | |
USE_TZ = True | |
LANGUAGE_CODE = 'en-us' | |
USE_I18N = True | |
USE_L10N = True | |
# SECURITY WARNING: keep the secret key used in production secret! | |
SECRET_KEY = '' | |
WSGI_APPLICATION = 'myproject.wsgi.application' | |
# ##################################################################################################################### | |
# DJANGO BACKENDS, ENGINES AND PROCESSORS | |
# ##################################################################################################################### | |
AUTHENTICATION_BACKENDS = ( | |
'django.contrib.auth.backends.ModelBackend', | |
'allauth.account.auth_backends.AuthenticationBackend', | |
) | |
SESSION_ENGINE = 'django.contrib.sessions.backends.signed_cookies' | |
TEMPLATE_CONTEXT_PROCESSORS = ( | |
'django.core.context_processors.request', | |
'django.contrib.auth.context_processors.auth', | |
'allauth.account.context_processors.account', | |
) | |
# ##################################################################################################################### | |
# PATHS | |
# ##################################################################################################################### | |
PROJECT_ROOT = os.path.dirname(os.path.dirname(__file__)) | |
PROJECT_NAME = PROJECT_ROOT.split(os.sep)[-1] | |
TEMPLATE_DIRS = [os.path.join(PROJECT_NAME, 'templates', PROJECT_NAME)] | |
STATICFILES_DIRS = [os.path.join(PROJECT_ROOT, PROJECT_NAME, 'static', PROJECT_NAME)] | |
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'public') | |
STATIC_URL = '/static/' | |
# MEDIA_ROOT = ... | |
MEDIA_URL = 'media/' | |
ROOT_URLCONF = '{0}.urls'.format(PROJECT_NAME) | |
# ##################################################################################################################### | |
# DATABASES | |
# ##################################################################################################################### | |
DATABASES = { | |
'default': { | |
'ENGINE': 'django.db.backends.sqlite3', | |
'NAME': os.path.join(PROJECT_ROOT, 'db.sqlite3'), | |
} | |
} | |
# ##################################################################################################################### | |
# PIPELINE SETTINGS | |
# ##################################################################################################################### | |
STATICFILES_STORAGE = 'core.util.GZIPCachedStorage' | |
PIPELINE_SASS_BINARY = '~/.rbenv/shims/sass' | |
PIPELINE_COMPILERS = ( | |
'pipeline.compilers.sass.SASSCompiler', | |
) | |
PIPELINE_CSS = { | |
'main': { | |
'source_filenames': ( | |
'vendor/css/fontawesome-4.03.min.css', | |
'sass/main.scss', | |
), | |
'output_filename': 'css/main.css', | |
}, | |
} | |
PIPELINE_JS = { | |
'main': { | |
'source_filenames': ( | |
'vendor/javascript/bootstrap-3.1.0.min.js', | |
'vendor/javascript/parsley.min.js', | |
), | |
'output_filename': 'javascript/main.js', | |
}, | |
} | |
# ##################################################################################################################### | |
# APPLICATIONS | |
# ##################################################################################################################### | |
INSTALLED_APPS = ( | |
'django.contrib.admin', | |
'django.contrib.auth', | |
'django.contrib.contenttypes', | |
'django.contrib.messages', | |
'django.contrib.staticfiles', | |
'django.contrib.sites', | |
'south', | |
'pipeline', | |
'debug_toolbar', | |
'template_timings_panel', | |
'django_extensions', | |
'widget_tweaks', | |
'parsley', | |
'allauth', | |
'allauth.account', | |
'account_settings', | |
'leads', | |
) | |
MIDDLEWARE_CLASSES = ( | |
'django.contrib.sessions.middleware.SessionMiddleware', | |
'django.middleware.common.CommonMiddleware', | |
'django.middleware.csrf.CsrfViewMiddleware', | |
'django.contrib.auth.middleware.AuthenticationMiddleware', | |
'django.contrib.messages.middleware.MessageMiddleware', | |
'django.middleware.clickjacking.XFrameOptionsMiddleware', | |
) | |
# ##################################################################################################################### | |
# DEBUG TOOLBAR | |
# ##################################################################################################################### | |
IGNORED_TEMPLATES = ['debug_toolbar/*'] | |
DEBUG_TOOLBAR_PANELS = [ | |
'debug_toolbar.panels.versions.VersionsPanel', | |
'debug_toolbar.panels.timer.TimerPanel', | |
'debug_toolbar.panels.settings.SettingsPanel', | |
'debug_toolbar.panels.headers.HeadersPanel', | |
'debug_toolbar.panels.request.RequestPanel', | |
'debug_toolbar.panels.sql.SQLPanel', | |
'debug_toolbar.panels.staticfiles.StaticFilesPanel', | |
'debug_toolbar.panels.templates.TemplatesPanel', | |
'template_timings_panel.panels.TemplateTimings.TemplateTimings', | |
'debug_toolbar.panels.cache.CachePanel', | |
'debug_toolbar.panels.signals.SignalsPanel', | |
'debug_toolbar.panels.logging.LoggingPanel', | |
'debug_toolbar.panels.redirects.RedirectsPanel', | |
] | |
# ##################################################################################################################### | |
# ALL AUTH | |
# ##################################################################################################################### | |
ACCOUNT_EMAIL_REQUIRED = True | |
ACCOUNT_EMAIL_VERIFICATION = None | |
ACCOUNT_AUTHENTICATION_METHOD = 'username_email' | |
ACCOUNT_LOGOUT_ON_GET = True | |
ACCOUNT_PASSWORD_MIN_LENGTH = 8 | |
ACCOUNT_SIGNUP_PASSWORD_VERIFICATION = False | |
LOGIN_REDIRECT_URL = '/' | |
ACCOUNT_LOGOUT_REDIRECT_URL = '/' |
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
from django.conf.urls import patterns, include, url | |
from django.contrib import admin | |
admin.autodiscover() | |
urlpatterns = patterns('', | |
url(r'^admin/', include(admin.site.urls)), | |
url(r'^accounts/', include('allauth.urls')), | |
url(r'^accounts/settings/', | |
include('account_settings.urls', namespace='account_settings')), | |
url(r'^leads/', include('leads.urls', namespace='leads')), | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment