Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,5 @@ target/
data/
*.sqlite
*.sqlite3

.direnv/
1 change: 1 addition & 0 deletions flint/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.direnv
Empty file added flint/flint/__init__.py
Empty file.
103 changes: 103 additions & 0 deletions flint/flint/settings.py
Original file line number Diff line number Diff line change
@@ -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/'
21 changes: 21 additions & 0 deletions flint/flint/urls.py
Original file line number Diff line number Diff line change
@@ -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)),
]
16 changes: 16 additions & 0 deletions flint/flint/wsgi.py
Original file line number Diff line number Diff line change
@@ -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()
10 changes: 10 additions & 0 deletions flint/manage.py
Original file line number Diff line number Diff line change
@@ -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)
Empty file added flint/tinder/__init__.py
Empty file.
7 changes: 7 additions & 0 deletions flint/tinder/admin.py
Original file line number Diff line number Diff line change
@@ -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)
34 changes: 34 additions & 0 deletions flint/tinder/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -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()),
],
),
]
27 changes: 27 additions & 0 deletions flint/tinder/migrations/0002_auto_20150708_0355.py
Original file line number Diff line number Diff line change
@@ -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),
),
]
24 changes: 24 additions & 0 deletions flint/tinder/migrations/0003_auto_20150708_0409.py
Original file line number Diff line number Diff line change
@@ -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'),
),
]
18 changes: 18 additions & 0 deletions flint/tinder/migrations/0004_auto_20150708_0415.py
Original file line number Diff line number Diff line change
@@ -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',
),
]
31 changes: 31 additions & 0 deletions flint/tinder/migrations/0005_comment_moment.py
Original file line number Diff line number Diff line change
@@ -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')),
],
),
]
31 changes: 31 additions & 0 deletions flint/tinder/migrations/0006_auto_20150708_1313.py
Original file line number Diff line number Diff line change
@@ -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',
),
]
Empty file.
38 changes: 38 additions & 0 deletions flint/tinder/models.py
Original file line number Diff line number Diff line change
@@ -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)
3 changes: 3 additions & 0 deletions flint/tinder/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
3 changes: 3 additions & 0 deletions flint/tinder/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.shortcuts import render

# Create your views here.