Skip to content

Instantly share code, notes, and snippets.

AssertionError at /api/1.0/product
Expected view ProductViewSet to be called with a URL keyword argument named "pk". Fix your URL conf, or set the `.lookup_field` attribute on the view correctly.
Request Method: OPTIONS
Request URL: http://localhost:8000/api/1.0/product
Django Version: 1.7
Exception Type: AssertionError
Exception Expected view ProductViewSet to be called with a URL keyword argument named "pk". Fix your URL conf, or set the `.lookup_field` attribute on the view correctly.
from rest_framework import routers, serializers, viewsets
from django.conf.urls import url, include
from core.views import *
class BatchRouter(routers.DefaultRouter):
routes = [
routers.Route(
url=r'^{prefix}{trailing_slash}$',
mapping={
'post': 'batch_create',
case class Node {
val connections: ListBuffer[Connection] = new ListBuffer[Connection]
}
case class Connection(
from: Node,
val to: Node,
val cost: Int,
private val directed: Boolean = true
) {
@ajrouvoet
ajrouvoet / -
Created September 16, 2014 13:49
import blogimplicits._
class BlogCtrl(db: Database) extends RestFullCtrl(Blogs, db) {
def parseId(s: String) = s.toInt
override val deserializer: PartialFunction[JValue, Blog] = {
case jobj:JObject => (jobj ~ ("author_id", 1))
.extract[Blog](defaultFormats, implicitly[Manifest[Blog]])
}
}
package nl.ncim.alc.models
import aj.slick.auth._
trait EndpointComponent { this: ActiveSlick => {
import jdbcDriver.simple._
case class Endpoint(
id: Option[Int],
mac_address: String
##
## Put me in ~/.irssi/scripts, and then execute the following in irssi:
##
## /load perl
## /script load notify
##
use strict;
use Irssi;
use vars qw($VERSION %IRSSI);
##
## Put me in ~/.irssi/scripts, and then execute the following in irssi:
##
## /load perl
## /script load notify
##
use strict;
use Irssi;
use vars qw($VERSION %IRSSI);
@ajrouvoet
ajrouvoet / Minesweeper.scala
Last active August 29, 2015 14:03
Minesweeper board init
import scala.util.Random
object Main {
type Board = List[List[Int]]
def main(argv: Array[String]) = {
val size: (Int, Int) = (80, 80)
val bombs = 250
---
title: Assignment 6
author:
- Arjen Rouvoet
---
## 1: Weighted Max-SAT
It's trivial to perform this parallel to the proof in the book.
Let $Z_i$ be a random variable indicating whether clause $i$ is satisfied ($Z_i$ is $1$ if $i$ is
using System;
using System.Collections.Generic;
namespace System.Reactive
{
public static class Observable
{
/// <summary>
/// Creates an observable sequence object from the specified subscription function.
/// </summary>