From d656b75e2e7e856330c63d02cc56dfab7b0a71ba Mon Sep 17 00:00:00 2001 From: SorenOlegnowicz Date: Wed, 8 Jul 2015 10:21:48 -0400 Subject: [PATCH] Tinder --- .gitignore | 2 + flint/.gitignore | 1 + flint/flint/__init__.py | 0 flint/flint/settings.py | 103 ++++++++++++++++++ flint/flint/urls.py | 21 ++++ flint/flint/wsgi.py | 16 +++ flint/manage.py | 10 ++ flint/tinder/__init__.py | 0 flint/tinder/admin.py | 7 ++ flint/tinder/migrations/0001_initial.py | 34 ++++++ .../migrations/0002_auto_20150708_0355.py | 27 +++++ .../migrations/0003_auto_20150708_0409.py | 24 ++++ .../migrations/0004_auto_20150708_0415.py | 18 +++ .../tinder/migrations/0005_comment_moment.py | 31 ++++++ .../migrations/0006_auto_20150708_1313.py | 31 ++++++ flint/tinder/migrations/__init__.py | 0 flint/tinder/models.py | 38 +++++++ flint/tinder/tests.py | 3 + flint/tinder/views.py | 3 + 19 files changed, 369 insertions(+) create mode 100644 flint/.gitignore create mode 100644 flint/flint/__init__.py create mode 100644 flint/flint/settings.py create mode 100644 flint/flint/urls.py create mode 100644 flint/flint/wsgi.py create mode 100755 flint/manage.py create mode 100644 flint/tinder/__init__.py create mode 100644 flint/tinder/admin.py create mode 100644 flint/tinder/migrations/0001_initial.py create mode 100644 flint/tinder/migrations/0002_auto_20150708_0355.py create mode 100644 flint/tinder/migrations/0003_auto_20150708_0409.py create mode 100644 flint/tinder/migrations/0004_auto_20150708_0415.py create mode 100644 flint/tinder/migrations/0005_comment_moment.py create mode 100644 flint/tinder/migrations/0006_auto_20150708_1313.py create mode 100644 flint/tinder/migrations/__init__.py create mode 100644 flint/tinder/models.py create mode 100644 flint/tinder/tests.py create mode 100644 flint/tinder/views.py diff --git a/.gitignore b/.gitignore index 56c4f0f..94c66f3 100644 --- a/.gitignore +++ b/.gitignore @@ -62,3 +62,5 @@ target/ data/ *.sqlite *.sqlite3 + +.direnv/ diff --git a/flint/.gitignore b/flint/.gitignore new file mode 100644 index 0000000..92b2793 --- /dev/null +++ b/flint/.gitignore @@ -0,0 +1 @@ +.direnv diff --git a/flint/flint/__init__.py b/flint/flint/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/flint/flint/settings.py b/flint/flint/settings.py new file mode 100644 index 0000000..0d616f3 --- /dev/null +++ b/flint/flint/settings.py @@ -0,0 +1,103 @@ +""" +Django settings for flint project. + +Generated by 'django-admin startproject' using Django 1.8.2. + +For more information on this file, see +https://docs.djangoproject.com/en/1.8/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/1.8/ref/settings/ +""" + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +import os + +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'qwn^nx%vp2!c!n598mb2i$1f2cy*_vahrps(yb7%+!*4bbs4a)' + +# SECURITY WARNING: don't run with debug turned on in production! +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', + 'tinder', +) + +MIDDLEWARE_CLASSES = ( + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'django.middleware.security.SecurityMiddleware', +) + +ROOT_URLCONF = 'flint.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'flint.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/1.8/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } +} + + +# Internationalization +# https://docs.djangoproject.com/en/1.8/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/1.8/howto/static-files/ + +STATIC_URL = '/static/' diff --git a/flint/flint/urls.py b/flint/flint/urls.py new file mode 100644 index 0000000..70e5c3d --- /dev/null +++ b/flint/flint/urls.py @@ -0,0 +1,21 @@ +"""flint URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/1.8/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') +Including another URLconf + 1. Add an import: from blog import urls as blog_urls + 2. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls)) +""" +from django.conf.urls import include, url +from django.contrib import admin + +urlpatterns = [ + url(r'^admin/', include(admin.site.urls)), +] diff --git a/flint/flint/wsgi.py b/flint/flint/wsgi.py new file mode 100644 index 0000000..e6ad7d8 --- /dev/null +++ b/flint/flint/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for flint 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.8/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "flint.settings") + +application = get_wsgi_application() diff --git a/flint/manage.py b/flint/manage.py new file mode 100755 index 0000000..c4615ef --- /dev/null +++ b/flint/manage.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python +import os +import sys + +if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "flint.settings") + + from django.core.management import execute_from_command_line + + execute_from_command_line(sys.argv) diff --git a/flint/tinder/__init__.py b/flint/tinder/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/flint/tinder/admin.py b/flint/tinder/admin.py new file mode 100644 index 0000000..87163dd --- /dev/null +++ b/flint/tinder/admin.py @@ -0,0 +1,7 @@ +from django.contrib import admin + +from .models import Profile, Preference, Comment +# Register your models here. +admin.site.register(Profile) +admin.site.register(Preference) +admin.site.register(Comment) diff --git a/flint/tinder/migrations/0001_initial.py b/flint/tinder/migrations/0001_initial.py new file mode 100644 index 0000000..e99a9d6 --- /dev/null +++ b/flint/tinder/migrations/0001_initial.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Profile', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, primary_key=True, auto_created=True)), + ('name', models.CharField(max_length=25)), + ('description', models.CharField(max_length=200)), + ('distance', models.IntegerField(default=1)), + ('age', models.IntegerField(default=18)), + ('sex', models.BooleanField()), + ('preferred_sex', models.BooleanField()), + ], + ), + migrations.CreateModel( + name='Queried', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, primary_key=True, auto_created=True)), + ('primary_id', models.IntegerField(default=None)), + ('preferred_id', models.IntegerField(default=None)), + ('preferrence', models.BooleanField()), + ], + ), + ] diff --git a/flint/tinder/migrations/0002_auto_20150708_0355.py b/flint/tinder/migrations/0002_auto_20150708_0355.py new file mode 100644 index 0000000..042e949 --- /dev/null +++ b/flint/tinder/migrations/0002_auto_20150708_0355.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('tinder', '0001_initial'), + ] + + operations = [ + migrations.RenameModel( + old_name='Queried', + new_name='Preferrence', + ), + migrations.AlterModelOptions( + name='preferrence', + options={'ordering': ['primary_id']}, + ), + migrations.AlterField( + model_name='profile', + name='description', + field=models.CharField(max_length=200, blank=True), + ), + ] diff --git a/flint/tinder/migrations/0003_auto_20150708_0409.py b/flint/tinder/migrations/0003_auto_20150708_0409.py new file mode 100644 index 0000000..9b9ef1a --- /dev/null +++ b/flint/tinder/migrations/0003_auto_20150708_0409.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('tinder', '0002_auto_20150708_0355'), + ] + + operations = [ + migrations.AlterField( + model_name='preferrence', + name='preferred_id', + field=models.ForeignKey(related_name='swiped', to='tinder.Profile'), + ), + migrations.AlterField( + model_name='preferrence', + name='primary_id', + field=models.ForeignKey(related_name='swiper', to='tinder.Profile'), + ), + ] diff --git a/flint/tinder/migrations/0004_auto_20150708_0415.py b/flint/tinder/migrations/0004_auto_20150708_0415.py new file mode 100644 index 0000000..04ffe41 --- /dev/null +++ b/flint/tinder/migrations/0004_auto_20150708_0415.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('tinder', '0003_auto_20150708_0409'), + ] + + operations = [ + migrations.RenameModel( + old_name='Preferrence', + new_name='Preference', + ), + ] diff --git a/flint/tinder/migrations/0005_comment_moment.py b/flint/tinder/migrations/0005_comment_moment.py new file mode 100644 index 0000000..1865404 --- /dev/null +++ b/flint/tinder/migrations/0005_comment_moment.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('tinder', '0004_auto_20150708_0415'), + ] + + operations = [ + migrations.CreateModel( + name='Comment', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('text', models.CharField(max_length=300)), + ('temp', models.BooleanField()), + ('profile', models.ForeignKey(to='tinder.Profile')), + ], + ), + migrations.CreateModel( + name='Moment', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('timestamp', models.DateTimeField(auto_now_add=True)), + ('comment', models.ForeignKey(to='tinder.Comment')), + ], + ), + ] diff --git a/flint/tinder/migrations/0006_auto_20150708_1313.py b/flint/tinder/migrations/0006_auto_20150708_1313.py new file mode 100644 index 0000000..eda4564 --- /dev/null +++ b/flint/tinder/migrations/0006_auto_20150708_1313.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('tinder', '0005_comment_moment'), + ] + + operations = [ + migrations.RemoveField( + model_name='moment', + name='comment', + ), + migrations.RenameField( + model_name='comment', + old_name='temp', + new_name='moment', + ), + migrations.AddField( + model_name='comment', + name='timestamp', + field=models.DateTimeField(auto_now_add=True, null=True), + ), + migrations.DeleteModel( + name='Moment', + ), + ] diff --git a/flint/tinder/migrations/__init__.py b/flint/tinder/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/flint/tinder/models.py b/flint/tinder/models.py new file mode 100644 index 0000000..f098cf9 --- /dev/null +++ b/flint/tinder/models.py @@ -0,0 +1,38 @@ +from django.contrib.auth.models import User +from django.db import models + +# Create your models here. + + +class Profile(models.Model): + name = models.CharField(max_length=25) + description = models.CharField(max_length=200, blank=True) + distance = models.IntegerField(default=1) # turn this into location (0,0) + age = models.IntegerField(default=18) + sex = models.BooleanField() # True = male + preferred_sex = models.BooleanField() + + def __str__(self): + return self.name + + +class Preference(models.Model): + primary_id = models.ForeignKey(Profile, related_name='swiper') + preferred_id = models.ForeignKey(Profile, related_name='swiped') + preferrence = models.BooleanField() + + class Meta: + ordering = ['primary_id'] + + def __str__(self): + if preferrence: + return "I want to make friends" + else: + return "Bleh" + + +class Comment(models.Model): + profile = models.ForeignKey(Profile) + text = models.CharField(max_length=300) + moment = models.BooleanField() + timestamp = models.DateTimeField(auto_now_add=True, null=True) diff --git a/flint/tinder/tests.py b/flint/tinder/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/flint/tinder/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/flint/tinder/views.py b/flint/tinder/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/flint/tinder/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here.