Skip to content

Instantly share code, notes, and snippets.

View kennethlove's full-sized avatar
🦀
Python

Kenneth Love kennethlove

🦀
Python
View GitHub Profile
#! /usr/bin/env python
pages = {
"start": {
"text": "It's a dark night outside. Somewhere a wolf howls.",
"prompt": "Where will you take shelter, the haunted house, or the bat "
"cave?",
"next": ("haunted house", "bat cave"),
},
"haunted house": {
class Post(models.Model):
created_at = models.DateTimeField(auto_now_add=True, editable=False)
updated_at = models.DateTimeField(auto_now=True, editable=False)
title = models.CharField(max_length=255)
slug = models.SlugField(max_length=255, blank=True, default='')
content = models.TextField()
published = models.BooleanField(default=True)
author = models.ForeignKey(User, related_name="posts")
objects = PostManager()
<h1 contentEditable="true" ng-model="name" title="Click to edit">
{{ selected_game.name }}
</h1>
<time>{{ selected_game.updated_at }}</time>
<div>
<button ng-click="$delete()" class="btn btn-danger">DELETE</button>
<a href="#/games">Back</a>
</div>
IntegrityError at /games/api/games/2a8a8cdc
duplicate key value violates unique constraint "games_game_pkey"
DETAIL: Key (id)=(11) already exists.
Request Method: PATCH
Request URL: http://gamenight.dev:8000/games/api/games/2a8a8cdc?_method=PATCH&format=json&name=Dungeon!
Django Version: 1.5
Python Executable: /Users/kennethlove/.virtualenvs/gamenight/bin/python
Python Version: 2.7.3
class GameSerializer(serializers.ModelSerializer):
class Meta:
model = Game
fields = ('id', 'name', 'ident')
here = lambda * x: os.path.join(os.path.abspath(os.path.dirname(__file__)), *x)
PROJECT_ROOT = here("..", "..")
root = lambda * x: os.path.join(os.path.abspath(PROJECT_ROOT), *x)
MEDIA_ROOT = root("media")
STATIC_ROOT = root("static")
STATICFILES_DIRS = (
root("assets"),
)
/ project_dir/
|
+- django/
|
+- assets/
+-- js /
+-- css /
[default] Attempting graceful shutdown of VM...
[default] Clearing any previously set forwarded ports...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!
[default] Mounting shared folders...
/usr/local/Cellar/ruby/1.9.3-p125/bin/ruby extconf.rb
extconf.rb:6: Use RbConfig instead of obsolete and deprecated Config.
checking for ffi.h in /usr/local/include... no
checking for rb_thread_blocking_region()... yes
creating extconf.h
creating Makefile
make
Configuring libffi
cd /usr/local/lib/ruby/gems/1.9.1/gems/ffi-0.6.3/ext/ffi_c/libffi && make