Articles

herokuのアプリケーションを複製する

herokuのアプリケーションって意外と簡単に複製できるんだよって話です。

アプリケーションを複製する

https://devcenter.heroku.com/articles/fork-app

プラグインのインストール

以前は、heroku CLIにforkコマンドが含まれていたようですが、現在は、プラグインとして切り出されているようです。
なのでheroku CLIにプラグインをインストールします。

[Django] Http Headerを取得、追加する方法

Djangoでリクエストヘッダやレスポンスヘッダを操作する方法のご紹介

基本

リクエストヘッダはHttpRequestMETA属性、レスポンスヘッダの内容はHttpResponseから辞書と同じ書法で設定、取得できます。

[Django] FormViewについて詳しく見てみる

今回はFormViewについて詳しく見てみましょう。

Githubよりソースコードを拝借します。

django/django https://github.com/django/django/tree/stable/2.2.x

FormView

では、FormViewから

class FormView(TemplateResponseMixin, BaseFormView):
    """A view for displaying a form and rendering a template response."""

二つほどクラスを継承しています。
TemplateResponseMixinBaseFormViewです。
FormViewの中身はBaseFormViewで実装されていそうな雰囲気です。

[Travis CI] matrixの設定

つい先日からtravis ci を触り始めて、ようやく.travis.ymlのmatrixの設定の意味がわかったので忘れないようにメモ

Travis CI

Travis CIは、GitHubと連携してコードのビルドやテストを行える、CIサービスです。
オープンソースのプロジェクトであれば無料で、プライベートプロジェクトであればで有料で利用することができます。

CSSでtableの行列(縦横)を入れ替える

cssだけでお手軽にtableの縦横の入れ替えができたらいいなって事で、それ用のテンプレートを置いておきます。

<table>
    <thead>
        <tr>
            <th></th>
            <th>午前</th>
            <th>午後</th>
        </tr>
    </thead>
    <tbody>
        <tr><th>月</th><td>◯</td><td>◯</td></tr>
        <tr><th>火</th><td>◯</td><td>◯</td></tr>
        <tr><th>水</th><td>◯</td><td>◯</td></tr>
        <tr><th>木</th><td>◯</td><td>◯</td></tr>
        <tr><th>金</th><td>◯</td><td>◯</td></tr>
        <tr><th>土</th><td>-</td><td>-</td></tr>
        <tr><th>日</th><td>-</td><td>-</td></tr>
    </tbody>
</table>
table {
    width: auto;
    border-right: 1px solid #eee;
    border-bottom: 1px solid #eee;
    border-collapse: collapse;
    border-spacing: 0;
}
th, td {
    display: block;
    width: auto;
    padding: 1em;
    text-align: center;
    border-top: 1px solid #eee;
    border-left: 1px solid #eee;
}
thead {
    display: flex;
    float: left;
}
thead th:first-child:before {
   padding: 1em;
}
tbody {
    display: flex;
    width: auto;
}
tbody tr {
    display: flex;
    flex-direction: column;
}

一応、flexに対応しているブラウザなら表示できるはず。