Post 1 - Lets Play. Setting up ‘Lets Play'
So this was a long post detailing the setting up of my new project; I’m guessing that in its majesty it was 1,500 words or so. But… one errant two-fingered swipe backwards, which counts as a ‘back’ button on a Mac, and what I’m guessing are several corrupted cloud saves later… I ended up right back at the start. With a grand total of 26 words.
In fact, even trying to publish this stub of an article has had some 404 issues with Subtle eating my god damn drafts.
Argh, I don’t think I can be bothered to write it all again. At least not right now.
Right, here’s the quick summary
I wanted to have a toy project to learn HTML, CSS/Bootstrap, JS, and Python/Django. I’m bad at all of these things. I decided to make a site to help gamers find new people to play games with online. It’s a problem that I’ve noticed for a while, where I only have a handful of people on my friends list that I like playing with. But, I’m so busy now that I don’t have time to just crunch games for hours on end to make new friends. What if there was a way to find other people to play with?
But you can basically find out what I did here.
Now that the Django website is set up, I need to actually start filling it out. The first step is to start thinking about what my database needs to look like.
I think that for an initial step, I’m going to ask people a series of questions to find out more about them. Later, I’ll build the logic for matching people based off of the information they’ve put in.
So, what would good questions be?
Let’s start with the basics: i) What platform are you looking to find friends on? ii) What is your name on that platform? and iii) What types of games do you play?
Later, I’d love to make it more nuanced maybe even asking people their education level, etc.; I could probably make use of Facebook Connect at some point too, but let’s hold off on all of that for right now and see if I can just do the basics without setting myself on fire.
platform_choice = models.CharField(max_length=200)
platform_name = models.CharField(max_length=200)
game_preference = models.CharField(max_length=200)
These are then related to another database, where I’ll be manipulating the data
question = models.ForeignKey(Question)
Once that’s saved, and I’ve made sure that ‘myapp’ is in INSTALLED_APPS, I can try running my first migration with South.
$ python manage.py schemamigration myapp —-auto
$ python manage.py migrate myapp
Great, now lets get off of this default looking Django page. First, create the template directory within the first mysite directory.
TEMPLATE_DIRS = (‘/Users/jasontraff/Dropbox/Code/letsplay/mysite/templates’)
Then, by editing views.py:
from django.shortcuts import render, render_to_response
from django.template import RequestContext
And urls.py to include:
And finally, creating an index.html in /templates to say Hello World!
You know this part, html tags all over the place
Now, let’s make our databases editable, easy to read, searchable, and filterable by editing admin.py so that it now looks like this:
from django.contrib import admin
from myapp.models import Question, Result
list_display = (‘platform_choice’, ‘platform_name’, ‘game_preference’)
list_filter = [‘platform_choice’, ‘platform_name’, ‘game_preference’]
search_fields = [‘platform_choice’, ‘platform_name’, ‘game_preference’]
Next up is to make the Question ‘detail’ page, which will display the question text and let people vote. (eek!)