This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
$ wget https://hugovk.github.io/top-pypi-packages/top-pypi-packages-30-days.json | |
$ python django-top-100.py | |
""" | |
import json | |
from pathlib import Path | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Continuous Integration | |
on: | |
- push | |
- pull_request | |
jobs: | |
test: | |
name: Run Python/Django Tests | |
runs-on: ubuntu-latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% load static %} | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>{% block title %}LearnDjango{% endblock title %} | LearnDjango.com</title> | |
<meta name="author" content="Learn Django"> | |
<meta name="description" content="{% block description %}Tutorials and courses on web development with Python and the Django Web Framework. {% endblock description %}"> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, | |
shrink-to-fit=no"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.7' | |
services: | |
web: | |
build: . | |
command: python /code/manage.py runserver 0.0.0.0:8000 | |
volumes: | |
- .:/code | |
ports: | |
- 8000:8000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# users/admin.py | |
from django.contrib import admin | |
from django.contrib.auth import get_user_model | |
from django.contrib.auth.admin import UserAdmin | |
from .forms import CustomUserCreationForm, CustomUserChangeForm | |
from .models import CustomUser | |
class CustomUserAdmin(UserAdmin): | |
add_form = CustomUserCreationForm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% extends 'base.html' %} | |
{% block content %} | |
<div class="container"> | |
<h2>{{ object.title }}</h2> | |
<p>Author: {{ object.author}}</p> | |
<p>Description: {{ object.description }}</p> | |
<p>Sections:</p> | |
<ul> | |
{% for section in course.sections.all %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
from school.models import Zipcode | |
def import_us_population(): | |
for csvfile in ( | |
'school_data/us_population_2014.csv', | |
): | |
with open(csvfile, 'rU') as csvinput: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// notes on this discussion from http://stackoverflow.com/questions/9960908/permutations-in-javascript |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print("Hi Haya"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~ brew --config | |
HOMEBREW_VERSION: 0.9.5 | |
ORIGIN: https://github.com/Homebrew/homebrew.git | |
HEAD: e8e2df1f67090d2d9d6b4a8440891a920727cd2a | |
HOMEBREW_PREFIX: /usr/local | |
HOMEBREW_CELLAR: /usr/local/Cellar | |
CPU: 8-core 64-bit ivybridge | |
OS X: 10.9.3-x86_64 | |
Xcode: 5.1.1 | |
CLT: 5.1.0.0.1.1396320587 |