Commit 532ebd6e388ee64ada5bd699a5f3b4852e93de12

Authored by Laura Hawkins
Exists in master

Flashcards user

Showing 3 changed files Inline Diff

*~ 1 1 *~
venv* 2 2 venv*
*.pyc 3 3 *.pyc
4 .idea*
flashy/flashcards/models.py View file @ 532ebd6
from django.db import models 1 1 from django.db import models
""" 2 2 """
Represents the relationship between a user and a flashcard by: 3 3 Represents the relationship between a user and a flashcard by:
1. A user has a flashcard in their deck 4 4 1. A user has a flashcard in their deck
2. A user used to have a flashcard in their deck 5 5 2. A user used to have a flashcard in their deck
3. A user has a flashcard hidden from them 6 6 3. A user has a flashcard hidden from them
""" 7 7 """
Class UserFlashcard(models.Models): 8 8 Class UserFlashcard(models.Models):
user = models.ForeignKey(User) 9 9 user = models.ForeignKey(User)
mask = models.ForeignKey(FlashcardMask) 10 10 mask = models.ForeignKey(FlashcardMask)
pulled = models.DateTimeField('date pulled') 11 11 pulled = models.DateTimeField('date pulled')
flashcard = models.ForeignKey(Flashcard) 12 12 flashcard = models.ForeignKey(Flashcard)
unpulled = model.DateTimeField('date unpulled') 13 13 unpulled = model.DateTimeField('date unpulled')
14 14
15
16 #comment
17
18 class FlashcardMask(models.Model):
19 ranges = models.CharField(max_length=255)
20
21 class Flashcard(models.Model):
22 text = models.CharField(max_length=255)
23 class = models.ForeignKey(Class)
24 pushed = models.DateTimeField()
25 material_date = models.DateTimeField()
26 previous = ForeignKey(Flashcard)
27 author = ForeignKey(User)
28 hidden = CharField(null=True, max_length=255)
29 mask = ForeignKey(FlashcardMask)
30
31 class UserFlashCardReview(models.Model):
32 user_flashcard = models.ForeignKey(UserFlashCard)
33 when = models.DateTimeField()
34 blanked_word = models.CharField(max_length=8)
35 response = models.CharField(max_length=256, blank=True, null=True)
36 correct = models.NullBooleanField()
37
38 class Class(models.Model):
39 department = models.CharField(max_length=50)
40 course_num = models.IntegerField()
41 name = models.CharField(max_length=50)
42 professor = models.CharField(max_length=50)
43 quarter = models.CharField(max_length=4)
flashy/flashy/settings.py View file @ 532ebd6
""" 1 1 """
Django settings for flashy project. 2 2 Django settings for flashy project.
3 3
Generated by 'django-admin startproject' using Django 1.8. 4 4 Generated by 'django-admin startproject' using Django 1.8.
5 5
For more information on this file, see 6 6 For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/ 7 7 https://docs.djangoproject.com/en/1.8/topics/settings/
8 8
For the full list of settings and their values, see 9 9 For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/ 10 10 https://docs.djangoproject.com/en/1.8/ref/settings/
""" 11 11 """
12 12
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) 13 13 # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os 14 14 import os
15 15
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 16 16 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
17 17
18 18
# Quick-start development settings - unsuitable for production 19 19 # Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ 20 20 # See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
21 21
# SECURITY WARNING: keep the secret key used in production secret! 22 22 # SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '8)#-j&8dghe-y&v4a%r6u#y@r86&6nfv%k$(a((r-zh$m3ct!9' 23 23 SECRET_KEY = '8)#-j&8dghe-y&v4a%r6u#y@r86&6nfv%k$(a((r-zh$m3ct!9'
24 24
# SECURITY WARNING: don't run with debug turned on in production! 25 25 # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True 26 26 DEBUG = True
27 27
ALLOWED_HOSTS = [] 28 28 ALLOWED_HOSTS = []
29 29
30 30
# Application definition 31 31 # Application definition
32 32
INSTALLED_APPS = ( 33 33 INSTALLED_APPS = (
'django.contrib.admin', 34 34 'django.contrib.admin',
'django.contrib.auth', 35 35 'django.contrib.auth',
'django.contrib.contenttypes', 36 36 'django.contrib.contenttypes',
'django.contrib.sessions', 37 37 'django.contrib.sessions',
'django.contrib.messages', 38 38 'django.contrib.messages',
'django.contrib.staticfiles', 39 39 'django.contrib.staticfiles',
40 'flashcards',
) 40 41 )
41 42
MIDDLEWARE_CLASSES = ( 42 43 MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware', 43 44 'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware', 44 45 'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware', 45 46 'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware', 46 47 'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 47 48 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware', 48 49 'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware', 49 50 'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware', 50 51 'django.middleware.security.SecurityMiddleware',
) 51 52 )
52 53
ROOT_URLCONF = 'flashy.urls' 53 54 ROOT_URLCONF = 'flashy.urls'
54 55
TEMPLATES = [ 55 56 TEMPLATES = [
{ 56 57 {
'BACKEND': 'django.template.backends.django.DjangoTemplates', 57 58 'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [], 58 59 'DIRS': [],
'APP_DIRS': True, 59 60 'APP_DIRS': True,
'OPTIONS': { 60 61 'OPTIONS': {
'context_processors': [ 61 62 'context_processors': [
'django.template.context_processors.debug', 62 63 'django.template.context_processors.debug',
'django.template.context_processors.request', 63 64 'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth', 64 65 'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages', 65 66 'django.contrib.messages.context_processors.messages',
], 66 67 ],
}, 67 68 },
}, 68 69 },
] 69 70 ]
70 71
WSGI_APPLICATION = 'flashy.wsgi.application' 71 72 WSGI_APPLICATION = 'flashy.wsgi.application'
72 73