Permalink
Browse files

Added project

  • Loading branch information...
colingourlay committed May 31, 2012
1 parent 205a5d9 commit 42c7332218cd078a87c4fbfebd782e30edadc44e
Showing with 16,091 additions and 0 deletions.
  1. 0 __init__.py
  2. +169 −0 settings.py
  3. +10 −0 templates/404.html
  4. +10 −0 templates/admin/base_site.html
  5. +10 −0 templates/flatpages/default.html
  6. +11 −0 urls.py
  7. 0 wholesale/__init__.py
  8. +110 −0 wholesale/models.py
  9. +4,883 −0 wholesale/static/wholesale/bootstrap-alt/css/bootstrap.css
  10. +729 −0 wholesale/static/wholesale/bootstrap-alt/css/bootstrap.min.css
  11. BIN wholesale/static/wholesale/bootstrap-alt/img/glyphicons-halflings-white.png
  12. BIN wholesale/static/wholesale/bootstrap-alt/img/glyphicons-halflings.png
  13. +1,835 −0 wholesale/static/wholesale/bootstrap-alt/js/bootstrap.js
  14. +7 −0 wholesale/static/wholesale/bootstrap-alt/js/bootstrap.min.js
  15. +791 −0 wholesale/static/wholesale/bootstrap/css/bootstrap-readable.min.css
  16. +3,932 −0 wholesale/static/wholesale/bootstrap/css/bootstrap.css
  17. +638 −0 wholesale/static/wholesale/bootstrap/css/bootstrap.min.css
  18. BIN wholesale/static/wholesale/bootstrap/img/glyphicons-halflings-white.png
  19. BIN wholesale/static/wholesale/bootstrap/img/glyphicons-halflings.png
  20. +1,733 −0 wholesale/static/wholesale/bootstrap/js/bootstrap.js
  21. +7 −0 wholesale/static/wholesale/bootstrap/js/bootstrap.min.js
  22. +258 −0 wholesale/static/wholesale/css/wholesale.css
  23. BIN wholesale/static/wholesale/img/banners/categories.png
  24. BIN wholesale/static/wholesale/img/banners/collections.png
  25. BIN wholesale/static/wholesale/img/banners/contact_banner.png
  26. BIN wholesale/static/wholesale/img/banners/contact_us.png
  27. BIN wholesale/static/wholesale/img/banners/products.png
  28. BIN wholesale/static/wholesale/img/banners/shortlist_banner.png
  29. BIN wholesale/static/wholesale/img/banners/shortlist_banner2.png
  30. BIN wholesale/static/wholesale/img/banners/your_shortlist.png
  31. BIN wholesale/static/wholesale/img/bg/black_linen.png
  32. BIN wholesale/static/wholesale/img/bg/black_linen_v2.png
  33. BIN wholesale/static/wholesale/img/bg/fabric_1.png
  34. BIN wholesale/static/wholesale/img/bg/fabric_plaid.png
  35. BIN wholesale/static/wholesale/img/bg/furley_bg.png
  36. BIN wholesale/static/wholesale/img/bg/handmadepaper.png
  37. BIN wholesale/static/wholesale/img/bg/hd.png
  38. BIN wholesale/static/wholesale/img/bg/paper.png
  39. BIN wholesale/static/wholesale/img/bg/pineapplecut.png
  40. BIN wholesale/static/wholesale/img/bg/pinstripe.png
  41. BIN wholesale/static/wholesale/img/bg/polaroid.png
  42. BIN wholesale/static/wholesale/img/bg/pool_table.png
  43. BIN wholesale/static/wholesale/img/bg/soft_pad.png
  44. BIN wholesale/static/wholesale/img/bg/white_plaster.png
  45. BIN wholesale/static/wholesale/img/bg/whitey.png
  46. BIN wholesale/static/wholesale/img/bg/wood_pattern.png
  47. BIN wholesale/static/wholesale/img/logo.png
  48. BIN wholesale/static/wholesale/img/logo_wholesale.png
  49. BIN wholesale/static/wholesale/img/pixel.png
  50. +287 −0 wholesale/static/wholesale/js/wholesale.js
  51. +60 −0 wholesale/templates/wholesale/base.html
  52. +15 −0 wholesale/templates/wholesale/categories.html
  53. +15 −0 wholesale/templates/wholesale/category.html
  54. +15 −0 wholesale/templates/wholesale/collection.html
  55. +15 −0 wholesale/templates/wholesale/collections.html
  56. +55 −0 wholesale/templates/wholesale/contact.html
  57. +33 −0 wholesale/templates/wholesale/includes/_category.html
  58. +33 −0 wholesale/templates/wholesale/includes/_collection.html
  59. +17 −0 wholesale/templates/wholesale/includes/_paginator.html
  60. +26 −0 wholesale/templates/wholesale/includes/_product.html
  61. +6 −0 wholesale/templates/wholesale/includes/_products.html
  62. +60 −0 wholesale/templates/wholesale/index.html
  63. +33 −0 wholesale/templates/wholesale/product.html
  64. +15 −0 wholesale/templates/wholesale/products.html
  65. +20 −0 wholesale/templates/wholesale/shortlist.html
  66. 0 wholesale/templatetags/__init__.py
  67. +45 −0 wholesale/templatetags/wholesale.py
  68. +16 −0 wholesale/tests.py
  69. +16 −0 wholesale/urls.py
  70. +169 −0 wholesale/views.py
  71. +7 −0 wsgi.py
View
No changes.
View
@@ -0,0 +1,169 @@
+# Django settings for myproject project.
+
+DEBUG = True
+TEMPLATE_DEBUG = DEBUG
+
+ADMINS = (
+ ('Colin Gourlay', 'colin.j.gourlay@gmail.com'),
+)
+
+MANAGERS = ADMINS
+
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
+ 'NAME': 'colingourlay_whd', # Or path to database file if using sqlite3.
+ 'USER': 'colingourlay_whd', # Not used with sqlite3.
+ 'PASSWORD': 'p0o9i8', # Not used with sqlite3.
+ 'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
+ 'PORT': '', # Set to empty string for default. Not used with sqlite3.
+ }
+}
+
+# Local time zone for this installation. Choices can be found here:
+# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
+# although not all choices may be available on all operating systems.
+# On Unix systems, a value of None will cause Django to use the same
+# timezone as the operating system.
+# If running in a Windows environment this must be set to the same as your
+# system time zone.
+TIME_ZONE = 'Australia/Brisbane'
+
+# Language code for this installation. All choices can be found here:
+# http://www.i18nguy.com/unicode/language-identifiers.html
+LANGUAGE_CODE = 'en-au'
+
+SITE_ID = 1
+
+# If you set this to False, Django will make some optimizations so as not
+# to load the internationalization machinery.
+USE_I18N = True
+
+# If you set this to False, Django will not format dates, numbers and
+# calendars according to the current locale.
+USE_L10N = True
+
+# If you set this to False, Django will not use timezone-aware datetimes.
+USE_TZ = True
+
+# Absolute filesystem path to the directory that will hold user-uploaded files.
+# Example: "/home/media/media.lawrence.com/media/"
+MEDIA_ROOT = '/home/colingourlay/webapps/media_hungrydesigns/wholesale/media/'
+
+# URL that handles the media served from MEDIA_ROOT. Make sure to use a
+# trailing slash.
+# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
+MEDIA_URL = 'http://media.hungrydesigns.com/wholesale/media/'
+
+# Absolute path to the directory static files should be collected to.
+# Don't put anything in this directory yourself; store your static files
+# in apps' "static/" subdirectories and in STATICFILES_DIRS.
+# Example: "/home/media/media.lawrence.com/static/"
+STATIC_ROOT = '/home/colingourlay/webapps/media_hungrydesigns/wholesale/static/'
+
+# URL prefix for static files.
+# Example: "http://media.lawrence.com/static/"
+STATIC_URL = 'http://media.hungrydesigns.com/wholesale/static/'
+
+# Additional locations of static files
+STATICFILES_DIRS = (
+ # Put strings here, like "/home/html/static" or "C:/www/django/static".
+ # Always use forward slashes, even on Windows.
+ # Don't forget to use absolute paths, not relative paths.
+)
+
+# List of finder classes that know how to find static files in
+# various locations.
+STATICFILES_FINDERS = (
+ 'django.contrib.staticfiles.finders.FileSystemFinder',
+ 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
+# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
+)
+
+# Make this unique, and don't share it with anybody.
+SECRET_KEY = '_1m1d%a=qhkprgv&zdmufk(_4py9oc5!fts4e5d@aqb5+c+pa('
+
+# List of callables that know how to import templates from various sources.
+TEMPLATE_LOADERS = (
+ 'django.template.loaders.filesystem.Loader',
+ 'django.template.loaders.app_directories.Loader',
+# 'django.template.loaders.eggs.Loader',
+)
+
+MIDDLEWARE_CLASSES = (
+ 'django.middleware.common.CommonMiddleware',
+ 'django.contrib.sessions.middleware.SessionMiddleware',
+ 'django.middleware.csrf.CsrfViewMiddleware',
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
+ 'django.contrib.messages.middleware.MessageMiddleware',
+ 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
+ # Uncomment the next line for simple clickjacking protection:
+ # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
+)
+
+ROOT_URLCONF = 'myproject.urls'
+
+# Python dotted path to the WSGI application used by Django's runserver.
+WSGI_APPLICATION = 'myproject.wsgi.application'
+
+TEMPLATE_DIRS = (
+ # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
+ # Always use forward slashes, even on Windows.
+ # Don't forget to use absolute paths, not relative paths.
+ '/home/colingourlay/webapps/wholesale_hungrydesigns/myproject/myproject/templates/',
+)
+
+INSTALLED_APPS = (
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.sites',
+ 'django.contrib.messages',
+ 'django.contrib.staticfiles',
+ 'django.contrib.admin',
+ 'django.contrib.admindocs',
+ 'django.contrib.flatpages',
+ 'myproject.wholesale',
+)
+
+# A sample logging configuration. The only tangible logging
+# performed by this configuration is to send an email to
+# the site admins on every HTTP 500 error when DEBUG=False.
+# See http://docs.djangoproject.com/en/dev/topics/logging for
+# more details on how to customize your logging configuration.
+LOGGING = {
+ 'version': 1,
+ 'disable_existing_loggers': False,
+ 'filters': {
+ 'require_debug_false': {
+ '()': 'django.utils.log.RequireDebugFalse'
+ }
+ },
+ 'handlers': {
+ 'mail_admins': {
+ 'level': 'ERROR',
+ 'filters': ['require_debug_false'],
+ 'class': 'django.utils.log.AdminEmailHandler'
+ }
+ },
+ 'loggers': {
+ 'django.request': {
+ 'handlers': ['mail_admins'],
+ 'level': 'ERROR',
+ 'propagate': True,
+ },
+ }
+}
+
+EMAIL_HOST = 'smtp.webfaction.com'
+EMAIL_HOST_USER = 'colingourlay_whd'
+EMAIL_HOST_PASSWORD = 'p0o9i8'
+DEFAULT_FROM_EMAIL = 'notifications@wholesale.hungrydesigns.com'
+SERVER_EMAIL = 'notifications@wholesale.hungrydesigns.com'
+
+CACHES = {
+ 'default': {
+ 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
+ 'LOCATION': 'unix:/home/colingourlay/memcached.sock',
+ }
+}
View
@@ -0,0 +1,10 @@
+{% extends "wholesale/base.html" %}
+{% load wholesale %}
+
+{% block main %}
+<h1>404 - Page Not Found</h1>
+<hr>
+{% snippet "404-top" %}
+<p>Sorry, the page you requested could not be found,</p>
+{% snippet "404-bottom" %}
+{% endblock main %}
@@ -0,0 +1,10 @@
+{% extends "admin/base.html" %}
+{% load i18n %}
+
+{% block title %}{{ title }} | Hungry Designs Wholesale Admin{% endblock %}
+
+{% block branding %}
+<h1 id="site-name">Hungry Designs Wholesale Admin</h1>
+{% endblock %}
+
+{% block nav-global %}{% endblock %}
@@ -0,0 +1,10 @@
+{% extends "wholesale/base.html" %}
+{% load wholesale %}
+
+{% block main %}
+<h1>{{ flatpage.title }}</h1>
+<hr>
+{% snippet "flatpage-top" %}
+{{ flatpage.content }}
+{% snippet "flatpage-bottom" %}
+{% endblock main %}
View
11 urls.py
@@ -0,0 +1,11 @@
+from django.conf.urls import patterns, include, url
+from django.contrib import admin
+
+
+admin.autodiscover()
+
+urlpatterns = patterns('',
+ url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
+ url(r'^admin/', include(admin.site.urls)),
+ url(r'', include('myproject.wholesale.urls')),
+)
View
No changes.
View
@@ -0,0 +1,110 @@
+from django.contrib import admin
+from django.db import models
+from django.template.defaultfilters import slugify
+
+
+class Category(models.Model):
+ name = models.CharField(max_length=100, unique=True)
+ slug = models.CharField(max_length=150, editable=False)
+
+ def __unicode__(self):
+ return self.name
+
+ def save(self, *args, **kwargs):
+ self.slug = slugify(self.name)
+ super(Category, self).save(*args, **kwargs)
+
+ @models.permalink
+ def get_absolute_url(self):
+ return ('category', [self.slug])
+
+ class Meta:
+ verbose_name_plural = "categories"
+ ordering = ['name']
+
+admin.site.register(Category)
+
+
+class Collection(models.Model):
+ name = models.CharField(max_length=100, unique=True)
+ slug = models.CharField(max_length=150, editable=False)
+
+ def __unicode__(self):
+ return self.name
+
+ def save(self, *args, **kwargs):
+ self.slug = slugify(self.name)
+ super(Collection, self).save(*args, **kwargs)
+
+ @models.permalink
+ def get_absolute_url(self):
+ return ('collection', [self.slug])
+
+ class Meta:
+ ordering = ['name']
+
+admin.site.register(Collection)
+
+
+class ProductManager(models.Manager):
+ def published(self):
+ return self.filter(published=True)
+
+
+class Product(models.Model):
+ name = models.CharField(max_length=100, unique=True)
+ slug = models.CharField(max_length=150, editable=False)
+ image = models.FileField(upload_to="product_images")
+ description = models.TextField()
+ wholesale_price = models.DecimalField(max_digits=6, decimal_places=2)
+ retail_price = models.DecimalField(max_digits=6, decimal_places=2, blank=True)
+ published = models.BooleanField()
+ categories = models.ManyToManyField(Category)
+ collections = models.ManyToManyField(Collection)
+
+ objects = ProductManager()
+
+ def __unicode__(self):
+ return self.name
+
+ def save(self, *args, **kwargs):
+ self.slug = slugify(self.name)
+ super(Product, self).save(*args, **kwargs)
+
+ @models.permalink
+ def get_absolute_url(self):
+ return ('product', [self.slug])
+
+ class Meta:
+ ordering = ['name']
+
+
+class ProductAdmin(admin.ModelAdmin):
+ actions_on_top = False
+ actions_on_bottom = True
+ list_display = ('name', 'published', 'wholesale_price', 'retail_price',)
+ list_filter = ('categories', 'collections', 'published',)
+ fieldsets = (
+ (None, {
+ 'fields': ('name', 'image', 'description', 'published')
+ }),
+ ('Pricing', {
+ 'fields': ('wholesale_price', 'retail_price')
+ }),
+ ('Taxonomy', {
+ 'fields': ('categories', 'collections')
+ }),
+ )
+ filter_horizontal = ('categories', 'collections',)
+
+admin.site.register(Product, ProductAdmin)
+
+
+class Snippet(models.Model):
+ slug = models.SlugField(max_length=100, unique=True)
+ template = models.TextField()
+
+ def __unicode__(self):
+ return self.slug
+
+admin.site.register(Snippet)
Oops, something went wrong.

0 comments on commit 42c7332

Please sign in to comment.