Commit ffb1a19a authored by Jean Michel Rouly's avatar Jean Michel Rouly
Browse files

Initial project creation.

parent 283de5c5
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
"""
Django settings for research-questions project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '6$(!s156i38csj@a+@)t4731v@+ig800g8__^0+%8imy=yt3*^'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'south',
'website',
)
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',
)
ROOT_URLCONF = 'settings.urls'
WSGI_APPLICATION = 'settings.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'prm_django',
'USER' : 'prm',
'PASSWORD' : 'jXufqNJAZ6B4S43G',
'HOST' : '',
'PORT': '',
}
}
# Internationalization
# https://docs.djangoproject.com/en/1.6/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'America/New_York'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.6/howto/static-files/
STATIC_URL = '/static/'
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.contrib import auth
admin.autodiscover()
urlpatterns = patterns('website.views',
# Examples:
# url(r'^$', 'settings.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
)
"""
WSGI config for research-questions project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
from django.db import models
from django.contrib import admin
from website.models import Question, Comment, Reply, User
# Register your models here.
admin.site.register(Question)
admin.site.register(Comment)
admin.site.register(Reply)
admin.site.register(User)
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Question'
db.create_table(u'website_question', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['website.User'])),
('date', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime(2013, 12, 2, 0, 0))),
('text', self.gf('django.db.models.fields.TextField')(max_length=1000)),
('rating', self.gf('django.db.models.fields.IntegerField')()),
))
db.send_create_signal(u'website', ['Question'])
# Adding model 'Comment'
db.create_table(u'website_comment', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['website.User'])),
('date', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime(2013, 12, 2, 0, 0))),
('text', self.gf('django.db.models.fields.TextField')()),
('parent', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['website.Question'])),
))
db.send_create_signal(u'website', ['Comment'])
# Adding model 'Reply'
db.create_table(u'website_reply', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['website.User'])),
('date', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime(2013, 12, 2, 0, 0))),
('text', self.gf('django.db.models.fields.TextField')()),
('parent', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['website.Comment'])),
))
db.send_create_signal(u'website', ['Reply'])
# Adding model 'User'
db.create_table(u'website_user', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('userid', self.gf('django.db.models.fields.CharField')(max_length=15)),
('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
('section', self.gf('django.db.models.fields.CharField')(max_length=5)),
('role', self.gf('django.db.models.fields.CharField')(max_length=20)),
('date', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime(2013, 12, 2, 0, 0))),
))
db.send_create_signal(u'website', ['User'])
def backwards(self, orm):
# Deleting model 'Question'
db.delete_table(u'website_question')
# Deleting model 'Comment'
db.delete_table(u'website_comment')
# Deleting model 'Reply'
db.delete_table(u'website_reply')
# Deleting model 'User'
db.delete_table(u'website_user')
models = {
u'website.comment': {
'Meta': {'object_name': 'Comment'},
'date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 12, 2, 0, 0)'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['website.Question']"}),
'text': ('django.db.models.fields.TextField', [], {}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['website.User']"})
},
u'website.question': {
'Meta': {'object_name': 'Question'},
'date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 12, 2, 0, 0)'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'rating': ('django.db.models.fields.IntegerField', [], {}),
'text': ('django.db.models.fields.TextField', [], {'max_length': '1000'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['website.User']"})
},
u'website.reply': {
'Meta': {'object_name': 'Reply'},
'date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 12, 2, 0, 0)'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['website.Comment']"}),
'text': ('django.db.models.fields.TextField', [], {}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['website.User']"})
},
u'website.user': {
'Meta': {'object_name': 'User'},
'date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 12, 2, 0, 0)'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'role': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
'section': ('django.db.models.fields.CharField', [], {'max_length': '5'}),
'userid': ('django.db.models.fields.CharField', [], {'max_length': '15'})
}
}
complete_apps = ['website']
\ No newline at end of file
from django.db import models
from datetime import datetime
# Create your models here.
class Question( models.Model ):
user = models.ForeignKey('User')
date = models.DateTimeField(default=datetime.now())
text = models.TextField(max_length=1000)
rating = models.IntegerField(default=0)
def __unicode__(self):
return '%s, %s' % ( self.user, self.date )
class Comment( models.Model ):
user = models.ForeignKey('User')
date = models.DateTimeField(default=datetime.now())
text = models.TextField()
parent = models.ForeignKey('Question')
def __unicode__(self):
return '%s, %s' % ( self.user, self.date )
class Reply( models.Model ):
user = models.ForeignKey('User')
date = models.DateTimeField(default=datetime.now())
text = models.TextField()
parent = models.ForeignKey('Comment')
def __unicode__(self):
return '%s, %s' % ( self.user, self.date )
class User( models.Model ):
userid = models.CharField(max_length=15)
name = models.CharField(max_length=100)
section = models.CharField(max_length=5)
role = models.CharField(max_length=20)
date = models.DateTimeField(default=datetime.now())
def email(self):
return self.userid + "@gmu.edu"
def __unicode__(self):
return self.name
from django.test import TestCase
# Create your tests here.
from website.models import Question, Comment, Reply, User
from django.shortcuts import render
# Create your views here.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment