Skip to content

Instantly share code, notes, and snippets.

View alxpck's full-sized avatar

Alex Peck alxpck

View GitHub Profile
@alxpck
alxpck / bootstrap-index-cdn
Last active December 26, 2016 18:42
Bootstrap: Index + CDNs
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
{% extends "base/theme.html" %}
{% load widget_tweaks %}
{% block main_content %}
<div class="header-buffer">
</div>
<section id="services">
<div class="container">
<div class="row">
{% if form %}
<div class="col-md-12">
from django.http import HttpResponse
def hello_world(request):
return HttpResponse('Hello World')
from django.db import models
# Create your models here.
class Course(models.Model):
created_at = models.DateTimeField(auto_now_add=True)
title = models.CharField(max_length=255)
description = models.TextField()
<!doctype html>
<html>
<head>
<title>{% block title %}{% endblock %}</title>
</head>
<body>{% block content %}{% endblock %}</body>
</html>
{% extends "layout.html" %}
{% block title %}{{ course.title }}{% endblock %}
{% block content %}
<article>
<h2>{{ course.title }}</h2>
{{ course.description }}
<section>
{% extends "layout.html" %}
{% block title %}{{ step.title }} - {{ step.course.title }}{% endblock %}
{% block content %}
<article>
<h2>{{ step.course.title }}</h2>
<h3>{{ step.title }}</h3>
{{ step.content|linebreaks }}
</article>
{% extends "layout.html" %}
{% block title %}Available Courses{% endblock %}
{% block content %}
<div class="cards">
{% for course in courses %}
<div class="card">
<header><a href="{% url 'detail' pk=course.pk %}">{{ course.title }}</a></header>
<div class="card-copy">
from django.test import TestCase
from django.utils import timezone
from .models import Course
# Create your tests here.
class CourseModelTests(TestCase):
def test_course_creation(self):
course = Course.objects.create(
title="Python Regular Expressions",
description="Learn to write regular expressions in Python"
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.utils import timezone
from .models import Course, Step
# Create your tests here.
class CourseModelTests(TestCase):
def test_course_creation(self):
course = Course.objects.create(