Kawaz

Build status Coverage Requirements Status

All your games are belong to us.

札幌ゲーム製作者コミュニティ Kawaz のポータルサイトの開発ドキュメントです。 開発・実行は Python 3.5 と Django 1.10 で行われています。

Kawaz をローカルにインストールする

Kawaz は GitHub 上で開発されているので 下記のようにローカルにチェックアウトしてください。

$ git clone https://github.com/kawazrepos/Kawaz3rd

また、上記URLではコミット権限を得られないため、開発メンバーに了承を得たコミット権のある方は 下記のように git アドレスを用いてください。

$ git clone git@github.com:kawazrepos/Kawaz3rd

次に開発に必要なサブモジュールとパッケージをインストールします。 この作業は依存するサブモジュールやパッケージの更新・追加などが発生した場合に毎回行う必要があります。 過去に動いていたのに動かなくなった場合は大抵下記の作業を行うと動くようになります

$ git submodule update --init --recursive
$ pip install -r config/requirements.txt
$ pip install -r config/requirements-test.txt
$ pip install -r config/requirements-docs.txt

テストを実行する

Kawaz はテスト駆動開発により開発が進められています。 変更を加えた場合は下記の手順に従って必ずテストが通ることを確認してください。

クリーンな環境でテストを実行する場合

どの環境においてもテストが成功することを保証するためにクリーンな環境でテストを実行することを強くおすすめします。 その際は tox を用いて下記のように行えば自動的にクリーンな環境でのテストが実行できます(事前に pip install tox で _tox を開発環境にインストールしておいてください)。

$ tox -c config/tox.ini

開発中に簡易的にテストを実行する場合

開発時は多くの変更を加えるため上記 tox を利用したテストは時間がかかり面倒なことが多いと思います。 その場合は下記のように現在の環境でテストを行うと比較的高速にテストを実行することができます。

$ python manage.py test kawaz                   # この場合すべての kawaz テストを実行します
$ python manage.py test kawaz.core.personas     # この場合 kawaz.core.personas のテストのみを実行します

ただし開発環境によりインストールされているパッケージ等に差異があるため リモートにプッシュする前に tox を利用したクリーンなテストを最低一度は実行することを強くおすすめします

開発サーバーを実行する

デザインやクライアントサイドコードの動作確認などを行う場合は開発用サーバーにて Kawaz を起動する必要があります。 このサーバーを起動するためには

  1. データベースの初期化
  2. 翻訳メッセージの初期化

の手順を事前に行う必要があるので、下記のようにこれらの初期化を行なってください。

$ python manage.py init_database        # データベースの初期化
$ python manage.py compilemessages      # 翻訳メッセージの初期化

なおこの初期化は対象部分(データベース・翻訳メッセージ)に変更を加えた際はその都度実行する必要があります。

これらの初期化が終わっている場合は下記のように honcho を利用してサーバーを起動することができます。

$ honcho start -f config/Procfile.dev

上記コマンドにより http://localhost:8000/ に開発用サーバーが http://localhost:35729/LiveReload 用サーバーが実行されます。 なお LiveReload 拡張が入った Google Chrome を利用するとファイル更新時に自動でブラウザの更新が呼ばれるためオススメです。

本番用サーバーを実行する

WIP

開発用サーバーを実行する際は下記の手順を踏んでください

  1. src/kawaz/local_settings.py を作成して下記の項目に関して設定を行う
    • 管理者のメールアドレス
    • キャッシュ関係の設定
    • データベースの設定
    • メール(送信用)の設定
    • SECRET_KEY の設定
    • Google Calendar ID の設定
    • その他(加筆求む)
  2. データが存在していない場合は python manage.py init_database にてデータベースの初期化を行う。 データが存在している場合は全データのロストにつながるため実行禁止
  3. python manage.py compilemessages にて翻訳メッセージのコンパイルを行う。 この作業は翻訳メッセージに変更が合った場合に毎度行う必要がある
  4. python manage.py collectstatic にて静的ファイルを public/static 以下に集める。 この作業は静的ファイルに変更が合った場合に毎度行う必要がある
  5. python manage.py compress にて CoffeeScript/JavaScript/CSS/Less の圧縮を行う。 この作業は上記ファイルに変更が合った場合に毎度行う必要がある

ドキュメントファイルを更新する

全てのドキュメントは docs フォルダ内に reStructuredText で書かれ Sphinx によりドキュメント化が行われている。 このドキュメントには

  1. 上記のような手順書
  2. ディレクトリ構成の説明や思想説明
  3. APIドキュメント

が含まれ、develop ブランチにプッシュすると自動的に KawazDevelopmentDocumentation に公開されます。

APIドキュメント以外の更新は適当にディレクトリ分割を行なって各自追加してください。 APIドキュメントの追加を行う場合は下記コマンドにて差分を追加できるので利用して下さい。 なおAPIドキュメントファイルを直接更新することは禁止します(変更したい場合はソースコードのコメントを修正してください)。

$ sphinx-apidoc -o docs/api src -f

ローカルでドキュメントをコンパイルする

ローカルでドキュメントをコンパイルする場合は下記コマンドにより docs/_build/html/index.html (ほか多数)が作成されます。

$ (cd docs; make html)

また Windows の場合は

$ (cd docs; make.bat html)

でコンパイルできる(はずです)

ドキュメント

kawaz Package

kawaz Package

local_settings.sample Module

pre_settings Module

settings Module

kawaz.settings.show_debug_toolbar(request)[ソース]

urls Module

wsgi Module

WSGI config for kawaz project.

It exposes the WSGI callable as a module-level variable named application.

For more information on this file, see https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/

Subpackages

api Package

filters Module
class kawaz.api.filters.KawazObjectPermissionFilterBackend[ソース]

ベースクラス: rest_framework.filters.BaseFilterBackend

A filter backend that limits results to those where the requesting user has read object level permissions.

filter_queryset(request, queryset, view)[ソース]
mixins Module
class kawaz.api.mixins.ReadModelMixin[ソース]

ベースクラス: object

A mixin for reading model objects.

It add get_queryset_for_read method and override get_queryset method.

get_queryset()[ソース]
get_queryset_for_read()[ソース]

Return a queryset for reading.

If the object manager have published method, this execute the method with self.request.user, otherwise it simply return all.

class kawaz.api.mixins.WriteModelMixin[ソース]

ベースクラス: object

A mixin for writing model objects.

It add get_queryset_for_write method and override get_queryset method.

get_queryset()[ソース]
get_queryset_for_write()[ソース]

Return a queryset for writing.

If the object manager have related method, this execute the method with self.request.user, otherwise it simply return all.

class kawaz.api.mixins.CreateModelMixin[ソース]

ベースクラス: rest_framework.mixins.CreateModelMixin

Create model instance and automatically save author

get_extra_fields()[ソース]
perform_create(serializer)[ソース]
class kawaz.api.mixins.ListModelMixin[ソース]

ベースクラス: object

List a queryset.

list(request, *args, **kwargs)[ソース]
class kawaz.api.mixins.RetrieveModelMixin[ソース]

ベースクラス: object

Retrieve a model instance.

retrieve(request, *args, **kwargs)[ソース]
class kawaz.api.mixins.UpdateModelMixin[ソース]

ベースクラス: object

Update a model instance.

partial_update(request, *args, **kwargs)[ソース]
perform_update(serializer)[ソース]
update(request, *args, **kwargs)[ソース]
class kawaz.api.mixins.DestroyModelMixin[ソース]

ベースクラス: object

Destroy a model instance.

destroy(request, *args, **kwargs)[ソース]
perform_destroy(instance)[ソース]
urls Module
views Module
class kawaz.api.views.KawazGenericViewSet(**kwargs)[ソース]

ベースクラス: rest_framework.viewsets.GenericViewSet

Kawaz で使用する API が通常行う設定を事前に行った GenericViewSet 下記に上げる設定が行われている

  • レスポンスをデフォルトでJSONで返すように指定
  • 権限チェックに DjangoModelPermissions と DjangoObjectPermissions を指定
  • フィルターバックエンドに DjangoFilterBackend と KawazObjectPermissionFilterBackend を指定
注意:
KawazObjectPermissionFilterBackend は全てのオブジェクトの権限をループ で検索するバックエンドのため大量のオブジェクトに対して実行すると実働 時間がかかる可能性が存在する
filter_backends = (<class 'rest_framework.filters.DjangoFilterBackend'>, <class 'kawaz.api.filters.KawazObjectPermissionFilterBackend'>)
permission_classes = (<class 'rest_framework.permissions.DjangoObjectPermissions'>, <class 'rest_framework.permissions.DjangoModelPermissions'>)
renderer_classes = (<class 'rest_framework.renderers.JSONRenderer'>,)
class kawaz.api.views.KawazModelViewSet(**kwargs)[ソース]

ベースクラス: kawaz.api.mixins.CreateModelMixin, rest_framework.mixins.RetrieveModelMixin, rest_framework.mixins.UpdateModelMixin, rest_framework.mixins.DestroyModelMixin, rest_framework.mixins.ListModelMixin, kawaz.api.views.KawazGenericViewSet

KawazGenericViewSet をベースとした読み書き用APIのViewSet retrieve, list に加え create, destroy, update, partial_update を提供

class kawaz.api.views.KawazReadOnlyModelViewSet(**kwargs)[ソース]

ベースクラス: rest_framework.mixins.RetrieveModelMixin, rest_framework.mixins.ListModelMixin, kawaz.api.views.KawazGenericViewSet

KawazGenericViewSet をベースとした読み込み専用APIのViewSet retrieve, list のみを提供

apps Package

apps Package
Subpackages
announcements Package
activity Module
class kawaz.apps.announcements.activity.AnnouncementActivityMediator[ソース]

ベースクラス: activities.mediator.ActivityMediator

alter(instance, activity, **kwargs)[ソース]
notifiers = ('twitter_kawaz_info', 'twitter_kawaz_official')
prepare_context(activity, context, typename=None)[ソース]
admin Module
class kawaz.apps.announcements.admin.AnnouncementAdmin(model, admin_site)[ソース]

ベースクラス: django.contrib.admin.options.ModelAdmin

media
search_fields = ('title', 'body', 'author__username', 'author__nickname')
forms Module
class kawaz.apps.announcements.forms.AnnouncementForm(*args, **kwargs)[ソース]

ベースクラス: kawaz.core.forms.mixins.Bootstrap3HorizontalFormHelperMixin, django.forms.models.ModelForm

class Meta[ソース]

ベースクラス: object

exclude = ('author', 'created_at', 'updated_at')
model

Announcement のエイリアス

AnnouncementForm.base_fields = OrderedDict([('pub_state', <django.forms.fields.TypedChoiceField object at 0x7fb59f88c978>), ('title', <django.forms.fields.CharField object at 0x7fb59f88c898>), ('body', <kawaz.core.forms.fields.MarkdownField object at 0x7fb59f88cd68>)])
AnnouncementForm.declared_fields = OrderedDict([('body', <kawaz.core.forms.fields.MarkdownField object at 0x7fb59f88cd68>)])
AnnouncementForm.media
models Module
class kawaz.apps.announcements.models.Announcement(*args, **kwargs)[ソース]

ベースクラス: django.db.models.base.Model

スタッフがメンバーに告知する際に使用するモデル

exception DoesNotExist

ベースクラス: django.core.exceptions.ObjectDoesNotExist

exception Announcement.MultipleObjectsReturned

ベースクラス: django.core.exceptions.MultipleObjectsReturned

Announcement.author

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Announcement.author_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Announcement.body

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Announcement.created_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Announcement.get_absolute_url()[ソース]
Announcement.get_next_by_created_at(*moreargs, **morekwargs)
Announcement.get_next_by_updated_at(*moreargs, **morekwargs)
Announcement.get_previous_by_created_at(*moreargs, **morekwargs)
Announcement.get_previous_by_updated_at(*moreargs, **morekwargs)
Announcement.get_pub_state_display(*moreargs, **morekwargs)
Announcement.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Announcement.last_modifier

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Announcement.last_modifier_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Announcement.objects = <kawaz.apps.announcements.models.AnnouncementManager object>
Announcement.pub_state

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Announcement.title

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Announcement.updated_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class kawaz.apps.announcements.models.AnnouncementManager[ソース]

ベースクラス: django.db.models.manager.Manager, kawaz.core.publishments.models.PublishmentManagerMixin

draft(user)[ソース]

下書き状態のAnnouncementインスタンスを含むクエリを返す。

ユーザーがスタッフの場合は全ての下書きインスタンスを含むもの、それ以外 の場合は空のクエリを返す

パラメタ:user (User instance) – DjangoのUserモデル
戻り値:指定されたユーザーに対して公開されているAnnouncementインスタンスを 含むQuerySet
published(user)[ソース]

指定されたユーザーに対して公開されているAnnouncementインスタンスを含む クエリを返す。

公開状態は指定されたユーザの所属によって変化する。 ユーザーが認証ユーザかつ[seele, nerv, chidlren]のいずれかに属している 場合は公開状態が public もしくは protected のものを、それ以外の場合 は公開状態が public になっているものだけを含む。

パラメタ:user (User instance) – DjangoのUserモデル
戻り値:指定されたユーザーに対して公開されているAnnouncementインスタンスを 含むQuerySet
perms Module
class kawaz.apps.announcements.perms.AnnouncementPermissionLogic[ソース]

ベースクラス: permission.logics.base.PermissionLogic

Announcementの権限クラス

スタッフユーザーはあらゆる権限を持ち、それ以外は記事の状態とメンバーか否か により閲覧権限が変わる

has_perm(user_obj, perm, obj=None)[ソース]
urls Module
views Module
class kawaz.apps.announcements.views.AnnouncementCreateView(**kwargs)[ソース]

ベースクラス: django.contrib.messages.views.SuccessMessageMixin, django.views.generic.edit.CreateView

dispatch(request, *args, **kwargs)
form_class

AnnouncementForm のエイリアス

form_valid(form)[ソース]
get_success_message(cleaned_data)[ソース]
model

Announcement のエイリアス

class kawaz.apps.announcements.views.AnnouncementDeleteView(**kwargs)[ソース]

ベースクラス: kawaz.core.views.delete.DeleteSuccessMessageMixin, django.views.generic.edit.DeleteView

dispatch(request, *args, **kwargs)
get_success_message()[ソース]
model

Announcement のエイリアス

success_url = <django.utils.functional.lazy.<locals>.__proxy__ object>
class kawaz.apps.announcements.views.AnnouncementDetailView(**kwargs)[ソース]

ベースクラス: django.views.generic.detail.DetailView

dispatch(request, *args, **kwargs)
model

Announcement のエイリアス

class kawaz.apps.announcements.views.AnnouncementListView(**kwargs)[ソース]

ベースクラス: django.views.generic.list.ListView

dispatch(request, *args, **kwargs)
get_queryset()[ソース]
model

Announcement のエイリアス

paginate_by = 5
class kawaz.apps.announcements.views.AnnouncementUpdateView(**kwargs)[ソース]

ベースクラス: django.contrib.messages.views.SuccessMessageMixin, django.views.generic.edit.UpdateView

dispatch(request, *args, **kwargs)
form_class

AnnouncementForm のエイリアス

form_valid(form)[ソース]
get_success_message(cleaned_data)[ソース]
model

Announcement のエイリアス

Subpackages
migrations Package
0001_initial Module
class kawaz.apps.announcements.migrations.0001_initial.Migration(name, app_label)[ソース]

ベースクラス: django.db.migrations.migration.Migration

dependencies = [('personas', '__first__')]
operations = [<CreateModel options={'ordering': ('-created_at',), 'permissions': (('view_announcement', 'Can view the announcement'),), 'verbose_name': 'Announcement', 'verbose_name_plural': 'Announcements'}, fields=[('id', <django.db.models.fields.AutoField>), ('pub_state', <django.db.models.fields.CharField>), ('title', <django.db.models.fields.CharField>), ('body', <django.db.models.fields.TextField>), ('created_at', <django.db.models.fields.DateTimeField>), ('updated_at', <django.db.models.fields.DateTimeField>), ('author', <django.db.models.fields.related.ForeignKey>), ('last_modifier', <django.db.models.fields.related.ForeignKey>)], bases=(<class 'django.db.models.base.Model'>,), name='Announcement'>]
templatetags Package
announcements_tags Module
kawaz.apps.announcements.templatetags.announcements_tags.get_announcements(context, lookup='published')[ソース]

任意の<lookup>によりフィルタされた Announcement のクエリを取得し指定された <variable>に格納するテンプレートタグ

Syntax:
{% get_announcements as <variable> %} {% get_announcements <lookup> as <variable> %}
Lookup: (Default: published)
published: ユーザーに対して公開された Announcement を返す draft: ユーザーが編集可能な下書き Announcement を返す

Examples

公開された Announcement のクエリを取得し、最新5件のみを描画

{% get_announcements as announcements %} {% for announcement in announcements|slice:”:5” %}

{{ announcement }}

{% endfor %}

下書き記事を取得

{% get_announcements ‘draft’ as draft_announcements %}

kawaz.apps.announcements.templatetags.announcements_tags.get_recent_announcements(context, lookup='published')[ソース]

get_announcementsで得られるQSのうち、作成日が1週間以内の物のみに絞り込む

tests Package
factories Module
test_activity Module
test_models Module
test_perms Module
test_templatetags Module
test_views Module
attachments Package
admin Module
class kawaz.apps.attachments.admin.MaterialAdmin(model, admin_site)[ソース]

ベースクラス: django.contrib.admin.options.ModelAdmin

author_nickname(obj)[ソース]
list_display = ('filename', 'slug', 'author_nickname', 'created_at')
media
readonly_fields = ('slug', 'author', 'ip_address', 'created_at')
search_fields = ('author__username', 'author__nickname')
models Module
class kawaz.apps.attachments.models.Material(*args, **kwargs)[ソース]

ベースクラス: django.db.models.base.Model

添付素材用のモデルです

exception DoesNotExist

ベースクラス: django.core.exceptions.ObjectDoesNotExist

exception Material.MultipleObjectsReturned

ベースクラス: django.core.exceptions.MultipleObjectsReturned

Material.author

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Material.author_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Material.content_file

The descriptor for the file attribute on the model instance. Returns a FieldFile when accessed so you can do stuff like:

>>> from myapp.models import MyModel
>>> instance = MyModel.objects.get(pk=1)
>>> instance.file.size

Assigns a file object on assignment so you can do:

>>> with open('/path/to/hello.world', 'r') as f:
...     instance.file = File(f)
Material.created_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Material.ext

アップされたファイルから拡張子を返します 拡張子は小文字になります。2つ以上拡張子がついている場合は最後の物のみが返却されます。

hoge.mp3 -> mp3 hoge.tar.gz -> gz hoge.WAV -> wav README ->
Material.filename

ファイル名を返します

Material.get_absolute_url()[ソース]
Material.get_attachment_tag()[ソース]
Material.get_next_by_created_at(*moreargs, **morekwargs)
Material.get_previous_by_created_at(*moreargs, **morekwargs)
Material.get_thumbnail_display()[ソース]
Material.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Material.ip_address

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Material.is_audio

音声ファイルかどうかを返します

Material.is_image

画像ファイルかどうかを返します

Material.is_movie

動画ファイルかどうかを返します

Material.is_pdf

PDFかどうかを返します

Material.mimetype

Mimetypeを返します

Material.objects = <django.db.models.manager.Manager object>
Material.save(*args, **kwargs)[ソース]
Material.slug

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

urls Module
views Module
class kawaz.apps.attachments.views.MaterialDetailView(**kwargs)[ソース]

ベースクラス: django.views.generic.detail.BaseDetailView

get(request, *args, **kwargs)[ソース]
model

Material のエイリアス

slug_field = 'slug'
Subpackages
api Package
api Package
serializers Module
class kawaz.apps.attachments.api.serializers.MaterialSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[ソース]

ベースクラス: rest_framework.serializers.ModelSerializer

class Meta[ソース]

ベースクラス: object

fields = ('content_file', 'author', 'slug', 'ip_address', 'tag')
model

Material のエイリアス

MaterialSerializer.create(validated_data)[ソース]
views Module
class kawaz.apps.attachments.api.views.MaterialViewSet(**kwargs)[ソース]

ベースクラス: kawaz.api.mixins.CreateModelMixin, kawaz.api.views.KawazGenericViewSet

author_field_name = 'author'
get_extra_fields()[ソース]
lookup_field = 'slug'
lookup_url_kwarg = 'slug'
model

Material のエイリアス

parser_classes = (<class 'rest_framework.parsers.FormParser'>, <class 'rest_framework.parsers.MultiPartParser'>)
queryset
serializer_class

MaterialSerializer のエイリアス

suffix = None
migrations Package
0001_initial Module
class kawaz.apps.attachments.migrations.0001_initial.Migration(name, app_label)[ソース]

ベースクラス: django.db.migrations.migration.Migration

dependencies = [('personas', '__first__')]
operations = [<CreateModel options={'ordering': ('created_at',), 'verbose_name': 'Material', 'verbose_name_plural': 'Materials'}, fields=[('id', <django.db.models.fields.AutoField>), ('content_file', <django.db.models.fields.files.FileField>), ('slug', <django.db.models.fields.SlugField>), ('ip_address', <django.db.models.fields.IPAddressField>), ('created_at', <django.db.models.fields.DateTimeField>), ('author', <django.db.models.fields.related.ForeignKey>)], bases=(<class 'django.db.models.base.Model'>,), name='Material'>]
templatetags Package
templatetags Package
attachments Module
kawaz.apps.attachments.templatetags.attachments.parse_attachments(value)[ソース]

{attachments:47c833254e45532d850cc40a0b8ec8b055b27c71}的なタグをparseします

Usage
{{ <value>|parse_attachments }}
tests Package
tests Package
factories Module
test_api Module
test_models Module
test_perms Module
test_templatetags Module
test_views Module
utils Package
utils Package
thumbnails Module
kawaz.apps.attachments.utils.thumbnails.get_thumbnail_html(material)[ソース]

渡したmaterialのファイルタイプに応じてサムネイル用のHTMLを返します

Param
Material material
blogs Package
activity Module
class kawaz.apps.blogs.activity.EntryActivityMediator[ソース]

ベースクラス: activities.mediator.ActivityMediator

alter(instance, activity, **kwargs)[ソース]
prepare_context(activity, context, typename=None)[ソース]
admin Module
class kawaz.apps.blogs.admin.EntryAdmin(model, admin_site)[ソース]

ベースクラス: django.contrib.admin.options.ModelAdmin

author_nickname(obj)[ソース]
list_display = ('title', 'author_nickname', 'get_pub_state_display', 'star_count', 'created_at', 'updated_at')
media
search_fields = ('title', 'body', 'author__username', 'author__nickname', 'category__label')
star_count(obj)[ソース]
forms Module
class kawaz.apps.blogs.forms.CategoryChoiceField(queryset, empty_label='---------', required=True, widget=None, label=None, initial=None, help_text='', to_field_name=None, limit_choices_to=None, *args, **kwargs)[ソース]

ベースクラス: django.forms.models.ModelChoiceField

ModelChoiceFieldのラベルにCategory.labelが使われるようにする

label_from_instance(obj)[ソース]
class kawaz.apps.blogs.forms.EntryForm(*args, **kwargs)[ソース]

ベースクラス: kawaz.core.forms.mixins.Bootstrap3HorizontalFormHelperMixin, django.forms.models.ModelForm

class Meta[ソース]

ベースクラス: object

exclude = ('author', 'created_at', 'updated_at', 'published_at')
model

Entry のエイリアス

EntryForm.base_fields = OrderedDict([('pub_state', <django.forms.fields.TypedChoiceField object at 0x7f95f4e970b8>), ('title', <django.forms.fields.CharField object at 0x7f95f4e97ac8>), ('body', <kawaz.core.forms.fields.MarkdownField object at 0x7f95f33819e8>), ('category', <kawaz.apps.blogs.forms.CategoryChoiceField object at 0x7f95f3381c18>)])
EntryForm.declared_fields = OrderedDict([('body', <kawaz.core.forms.fields.MarkdownField object at 0x7f95f33819e8>), ('category', <kawaz.apps.blogs.forms.CategoryChoiceField object at 0x7f95f3381c18>)])
EntryForm.media
models Module
class kawaz.apps.blogs.models.Category(*args, **kwargs)[ソース]

ベースクラス: django.db.models.base.Model

ブログが所属するカテゴリーモデル

カテゴリーは各ユーザーがそれぞれ所有するもので、自身のブログの整理に利用する 目的で存在する。

exception DoesNotExist

ベースクラス: django.core.exceptions.ObjectDoesNotExist

exception Category.MultipleObjectsReturned

ベースクラス: django.core.exceptions.MultipleObjectsReturned

Category.author

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Category.author_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Category.entries

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Category.get_absolute_url()[ソース]
Category.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Category.label

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Category.objects = <django.db.models.manager.Manager object>
class kawaz.apps.blogs.models.Entry(*args, **kwargs)[ソース]

ベースクラス: django.db.models.base.Model

ブログ記事モデル

exception DoesNotExist

ベースクラス: django.core.exceptions.ObjectDoesNotExist

exception Entry.MultipleObjectsReturned

ベースクラス: django.core.exceptions.MultipleObjectsReturned

Entry.author

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Entry.author_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Entry.body

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Entry.category

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Entry.category_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Entry.clean()[ソース]
Entry.created_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Entry.get_absolute_url()[ソース]
Entry.get_next_by_created_at(*moreargs, **morekwargs)
Entry.get_next_by_updated_at(*moreargs, **morekwargs)
Entry.get_previous_by_created_at(*moreargs, **morekwargs)
Entry.get_previous_by_updated_at(*moreargs, **morekwargs)
Entry.get_pub_state_display(*moreargs, **morekwargs)
Entry.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Entry.objects = <kawaz.apps.blogs.models.EntryManager object>
Entry.pub_state

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Entry.published_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Entry.published_at_date

公開日

Entry.save(*args, **kwargs)[ソース]
Entry.title

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Entry.updated_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class kawaz.apps.blogs.models.EntryManager[ソース]

ベースクラス: django.db.models.manager.Manager, kawaz.core.publishments.models.PublishmentManagerMixin

urls Module
views Module
class kawaz.apps.blogs.views.EntryAuthorDayArchiveView(**kwargs)[ソース]

ベースクラス: kawaz.apps.blogs.views.EntryDayArchiveView, kawaz.apps.blogs.views.EntryAuthorMixin

class kawaz.apps.blogs.views.EntryAuthorListView(**kwargs)[ソース]

ベースクラス: kawaz.apps.blogs.views.EntryListView, kawaz.apps.blogs.views.EntryAuthorMixin

class kawaz.apps.blogs.views.EntryAuthorMixin[ソース]

ベースクラス: kawaz.apps.blogs.views.EntryMultipleObjectMixin

特定ユーザーが執筆した記事に限定して閲覧するためのMixin

get_context_data(**kwargs)[ソース]
get_queryset()[ソース]
class kawaz.apps.blogs.views.EntryAuthorMonthArchiveView(**kwargs)[ソース]

ベースクラス: kawaz.apps.blogs.views.EntryMonthArchiveView, kawaz.apps.blogs.views.EntryAuthorMixin

class kawaz.apps.blogs.views.EntryAuthorTodayArchiveView(**kwargs)[ソース]

ベースクラス: kawaz.apps.blogs.views.EntryTodayArchiveView, kawaz.apps.blogs.views.EntryAuthorMixin

class kawaz.apps.blogs.views.EntryAuthorYearArchiveView(**kwargs)[ソース]

ベースクラス: kawaz.apps.blogs.views.EntryYearArchiveView, kawaz.apps.blogs.views.EntryAuthorMixin

class kawaz.apps.blogs.views.EntryCategoryListView(**kwargs)[ソース]

ベースクラス: kawaz.apps.blogs.views.EntryAuthorMixin, django.views.generic.list.ListView

get_context_data(**kwargs)[ソース]
get_queryset()[ソース]
template_name = 'blogs/entry_list.html'
class kawaz.apps.blogs.views.EntryCreateView(**kwargs)[ソース]

ベースクラス: django.contrib.messages.views.SuccessMessageMixin, django.views.generic.edit.CreateView

dispatch(request, *args, **kwargs)
form_class

EntryForm のエイリアス

get_form(form_class=<class 'kawaz.apps.blogs.forms.EntryForm'>)[ソース]
get_form_kwargs()[ソース]
get_success_message(cleaned_data)[ソース]
model

Entry のエイリアス

class kawaz.apps.blogs.views.EntryDayArchiveView(**kwargs)[ソース]

ベースクラス: django.views.generic.dates.DayArchiveView, kawaz.apps.blogs.views.EntryMultipleObjectMixin

date_field = 'published_at'
model

Entry のエイリアス

month_format = '%m'
class kawaz.apps.blogs.views.EntryDeleteView(**kwargs)[ソース]

ベースクラス: kawaz.core.views.delete.DeleteSuccessMessageMixin, django.views.generic.edit.DeleteView

dispatch(request, *args, **kwargs)
get_success_message()[ソース]
model

Entry のエイリアス

success_url = <django.utils.functional.lazy.<locals>.__proxy__ object>
class kawaz.apps.blogs.views.EntryDetailView(**kwargs)[ソース]

ベースクラス: django.views.generic.detail.DetailView

dispatch(request, *args, **kwargs)
model

Entry のエイリアス

class kawaz.apps.blogs.views.EntryListView(**kwargs)[ソース]

ベースクラス: django.views.generic.list.ListView, kawaz.apps.blogs.views.EntryMultipleObjectMixin

dispatch(request, *args, **kwargs)
model

Entry のエイリアス

class kawaz.apps.blogs.views.EntryMonthArchiveView(**kwargs)[ソース]

ベースクラス: django.views.generic.dates.MonthArchiveView, kawaz.apps.blogs.views.EntryMultipleObjectMixin

date_field = 'published_at'
model

Entry のエイリアス

month_format = '%m'
class kawaz.apps.blogs.views.EntryMultipleObjectMixin[ソース]

ベースクラス: django.views.generic.list.MultipleObjectMixin

アクセスしたユーザーにより閲覧可能な記事を指定するためのMixin

get_queryset()[ソース]
paginate_by = 5
class kawaz.apps.blogs.views.EntryPreviewView(**kwargs)[ソース]

ベースクラス: kawaz.core.views.preview.SingleObjectPreviewViewMixin, django.views.generic.detail.DetailView

model

Entry のエイリアス

template_name = 'blogs/components/entry_detail.html'
class kawaz.apps.blogs.views.EntryTodayArchiveView(**kwargs)[ソース]

ベースクラス: django.views.generic.dates.TodayArchiveView, kawaz.apps.blogs.views.EntryMultipleObjectMixin

date_field = 'published_at'
model

Entry のエイリアス

class kawaz.apps.blogs.views.EntryUpdateView(**kwargs)[ソース]

ベースクラス: django.contrib.messages.views.SuccessMessageMixin, django.views.generic.edit.UpdateView

dispatch(request, *args, **kwargs)
form_class

EntryForm のエイリアス

get_form_kwargs()[ソース]
get_success_message(cleaned_data)[ソース]
model

Entry のエイリアス

class kawaz.apps.blogs.views.EntryYearArchiveView(**kwargs)[ソース]

ベースクラス: django.views.generic.dates.YearArchiveView, kawaz.apps.blogs.views.EntryMultipleObjectMixin

allow_empty = True
date_field = 'published_at'
model

Entry のエイリアス

Subpackages
api Package
api Package
serializers Module
class kawaz.apps.blogs.api.serializers.CategorySerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[ソース]

ベースクラス: rest_framework.serializers.ModelSerializer

ブログカテゴリ用のAPIシリアライザ

class Meta[ソース]

ベースクラス: object

fields = ('id', 'author', 'label')
model

Category のエイリアス

CategorySerializer.create(validated_data)[ソース]
views Module
class kawaz.apps.blogs.api.views.CategoryViewSet(**kwargs)[ソース]

ベースクラス: kawaz.api.mixins.CreateModelMixin, kawaz.api.views.KawazGenericViewSet

ブログカテゴリを作成するためのAPIエンドポイント

author_field_name = 'author'
model

Category のエイリアス

queryset
serializer_class

CategorySerializer のエイリアス

suffix = None
migrations Package
0001_initial Module
class kawaz.apps.blogs.migrations.0001_initial.Migration(name, app_label)[ソース]

ベースクラス: django.db.migrations.migration.Migration

dependencies = [('personas', '__first__')]
operations = [<CreateModel options={}, fields=[('id', <django.db.models.fields.AutoField>), ('label', <django.db.models.fields.CharField>), ('author', <django.db.models.fields.related.ForeignKey>)], bases=(<class 'django.db.models.base.Model'>,), name='Category'>, <CreateModel options={'ordering': ('-updated_at', 'title'), 'permissions': (('view_entry', 'Can view the entry'),), 'verbose_name': 'Entry', 'verbose_name_plural': 'Entries'}, fields=[('id', <django.db.models.fields.AutoField>), ('pub_state', <django.db.models.fields.CharField>), ('title', <django.db.models.fields.CharField>), ('body', <django.db.models.fields.TextField>), ('created_at', <django.db.models.fields.DateTimeField>), ('updated_at', <django.db.models.fields.DateTimeField>), ('publish_at', <django.db.models.fields.DateTimeField>), ('author', <django.db.models.fields.related.ForeignKey>), ('category', <django.db.models.fields.related.ForeignKey>)], bases=(<class 'django.db.models.base.Model'>,), name='Entry'>, <AlterUniqueTogether unique_together={('author', 'label')}, name='category'>]
0002_auto_20141123_0104 Module
class kawaz.apps.blogs.migrations.0002_auto_20141123_0104.Migration(name, app_label)[ソース]

ベースクラス: django.db.migrations.migration.Migration

dependencies = [('blogs', '0001_initial')]
operations = [<RenameField model_name='entry', old_name='publish_at', new_name='published_at'>]
templatetags Package
blogs_tags Module
kawaz.apps.blogs.templatetags.blogs_tags.get_categories(author=None)[ソース]

ブログ記事カテゴリ一覧を取り出します <user>を渡した場合は、そのユーザーが持っているカテゴリのみを取り出します

Syntax:
{% get_categories as categories %} {% get_categories <user> as categories %}
kawaz.apps.blogs.templatetags.blogs_tags.get_entries(context, lookup='published')[ソース]

任意の<lookup>によりフィルタされた Entry のクエリを取得し指定された <variable>に格納するテンプレートタグ

Syntax:
{% get_entries as <variable> %} {% get_entries <lookup> as <variable> %}
Lookup: (Default: published)
published: ユーザーに対して公開された Entry を返す draft: ユーザーが編集可能な下書き Entry を返す

Examples

公開された Entry のクエリを取得し、最新5件のみを描画

{% get_entries as entries %} {% for entry in entries|slice:”:5” %}

{{ entry }}

{% endfor %}

下書き記事を取得

{% get_entries ‘draft’ as draft_entries %}

kawaz.apps.blogs.templatetags.blogs_tags.get_published_entries_of(context, author)[ソース]

あるユーザーの書いたpublishedなエントリーを返します

Syntax:
{% get_published_entries_of <user> as <variable> %}
tests Package
tests Package
factories Module
test_activity Module
test_api Module
test_forms Module
test_models Module
test_perms Module
test_templatetags Module
Subpackages
views Package
views Package
test_crud Module
test_date Module
events Package
activity Module
class kawaz.apps.events.activity.EventActivityMediator[ソース]

ベースクラス: activities.mediator.ActivityMediator

alter(instance, activity, **kwargs)[ソース]
m2m_fields = ('attendees',)
prepare_context(activity, context, typename=None)[ソース]
admin Module
class kawaz.apps.events.admin.EventAdmin(model, admin_site)[ソース]

ベースクラス: django.contrib.admin.options.ModelAdmin

list_display = ('title', 'organizer_name', 'get_pub_state_display', 'period_start', 'number_of_attendees', 'created_at', 'updated_at')
media
number_of_attendees(obj)[ソース]
organizer_name(obj)[ソース]
save_model(request, obj, form, change)[ソース]
search_fields = ('title', 'body', 'organizer__username', 'organizer__nickname', 'category__label', 'place')
class kawaz.apps.events.admin.EventCategoryAdmin(model, admin_site)[ソース]

ベースクラス: django.contrib.admin.options.ModelAdmin

list_display = ('label', 'number_of_events')
media
number_of_events(obj)[ソース]
filters Module
class kawaz.apps.events.filters.EventFilter(data=None, queryset=None, prefix=None, strict=None, request=None)[ソース]

ベースクラス: django_filters.filterset.FilterSet

class Meta[ソース]

ベースクラス: object

fields = ['category']
model

Event のエイリアス

EventFilter.base_filters = OrderedDict([('category', <django_filters.filters.ModelChoiceFilter object at 0x7fb59ec660b8>)])
EventFilter.declared_filters = OrderedDict([('category', <django_filters.filters.ModelChoiceFilter object at 0x7fb59ec660b8>)])
forms Module
class kawaz.apps.events.forms.EventCreationForm(*args, **kwargs)[ソース]

ベースクラス: kawaz.apps.events.forms.EventForm

class Meta[ソース]

ベースクラス: object

exclude = ('organizer', 'created_at', 'updated_at', 'attendees')
model

Event のエイリアス

EventCreationForm.base_fields = OrderedDict([('pub_state', <django.forms.fields.TypedChoiceField object at 0x7fb59eb806a0>), ('title', <django.forms.fields.CharField object at 0x7fb59eb804a8>), ('body', <kawaz.core.forms.fields.MarkdownField object at 0x7fb59eb60208>), ('period_start', <django.forms.fields.DateTimeField object at 0x7fb59ec436d8>), ('period_end', <django.forms.fields.DateTimeField object at 0x7fb59ec43048>), ('place', <django.forms.fields.CharField object at 0x7fb59eb80be0>), ('number_restriction', <django.forms.fields.IntegerField object at 0x7fb59eb80d30>), ('attendance_deadline', <django.forms.fields.DateTimeField object at 0x7fb59eb80080>), ('category', <django.forms.models.ModelChoiceField object at 0x7fb59eb80e80>)])
EventCreationForm.declared_fields = OrderedDict([('body', <kawaz.core.forms.fields.MarkdownField object at 0x7fb59eb60208>), ('period_start', <django.forms.fields.DateTimeField object at 0x7fb59ec436d8>), ('period_end', <django.forms.fields.DateTimeField object at 0x7fb59ec43048>), ('attendance_deadline', <django.forms.fields.DateTimeField object at 0x7fb59eb80080>)])
EventCreationForm.media
class kawaz.apps.events.forms.EventForm(*args, **kwargs)[ソース]

ベースクラス: kawaz.core.forms.mixins.Bootstrap3HorizontalFormHelperMixin, django.forms.models.ModelForm

class Meta[ソース]

ベースクラス: object

exclude = ('organizer', 'created_at', 'updated_at')
model

Event のエイリアス

EventForm.base_fields = OrderedDict([('pub_state', <django.forms.fields.TypedChoiceField object at 0x7fb59eb80160>), ('title', <django.forms.fields.CharField object at 0x7fb59eb801d0>), ('body', <kawaz.core.forms.fields.MarkdownField object at 0x7fb59eb60208>), ('period_start', <django.forms.fields.DateTimeField object at 0x7fb59ec436d8>), ('period_end', <django.forms.fields.DateTimeField object at 0x7fb59ec43048>), ('place', <django.forms.fields.CharField object at 0x7fb59eb804e0>), ('number_restriction', <django.forms.fields.IntegerField object at 0x7fb59eb80630>), ('attendance_deadline', <django.forms.fields.DateTimeField object at 0x7fb59eb80080>), ('attendees', <django.forms.models.ModelMultipleChoiceField object at 0x7fb59eb80780>), ('category', <django.forms.models.ModelChoiceField object at 0x7fb59eb80940>)])
EventForm.declared_fields = OrderedDict([('body', <kawaz.core.forms.fields.MarkdownField object at 0x7fb59eb60208>), ('period_start', <django.forms.fields.DateTimeField object at 0x7fb59ec436d8>), ('period_end', <django.forms.fields.DateTimeField object at 0x7fb59ec43048>), ('attendance_deadline', <django.forms.fields.DateTimeField object at 0x7fb59eb80080>)])
EventForm.media
class kawaz.apps.events.forms.EventUpdateForm(*args, **kwargs)[ソース]

ベースクラス: kawaz.apps.events.forms.EventForm

base_fields = OrderedDict([('pub_state', <django.forms.fields.TypedChoiceField object at 0x7fb59eb80358>), ('title', <django.forms.fields.CharField object at 0x7fb59eb0a0f0>), ('body', <kawaz.core.forms.fields.MarkdownField object at 0x7fb59eb60208>), ('period_start', <django.forms.fields.DateTimeField object at 0x7fb59ec436d8>), ('period_end', <django.forms.fields.DateTimeField object at 0x7fb59ec43048>), ('place', <django.forms.fields.CharField object at 0x7fb59eb0a400>), ('number_restriction', <django.forms.fields.IntegerField object at 0x7fb59eb0a550>), ('attendance_deadline', <django.forms.fields.DateTimeField object at 0x7fb59eb80080>), ('attendees', <kawaz.core.personas.forms.persona.PersonaChoiceField object at 0x7fb59eb80b38>), ('category', <django.forms.models.ModelChoiceField object at 0x7fb59eb6d5c0>)])
declared_fields = OrderedDict([('body', <kawaz.core.forms.fields.MarkdownField object at 0x7fb59eb60208>), ('period_start', <django.forms.fields.DateTimeField object at 0x7fb59ec436d8>), ('period_end', <django.forms.fields.DateTimeField object at 0x7fb59ec43048>), ('attendance_deadline', <django.forms.fields.DateTimeField object at 0x7fb59eb80080>), ('attendees', <kawaz.core.personas.forms.persona.PersonaChoiceField object at 0x7fb59eb80b38>)])
media
gcal Module

Google Calendar 連携用 Backend kawaz.core.google.calendar に依存し settings.GOOGLE_CALENDAR_BACKEND で指定 されている

class kawaz.apps.events.gcal.KawazGoogleCalendarBackend[ソース]

ベースクラス: google_calendar.backend.Backend

is_valid(event, raise_exception=False)[ソース]

Kawaz3のEventモデルインスタンスが、Google Calendar API Version3の Bodyパラメーターと適合しているかをチェックします

translate(event)[ソース]

Kawaz3のEventモデルをGoogle Calendar API Version3のBodyパラメーターに変換します

Params:
event [Event] Eventモデルインスタンス
戻り値:[dict] パラメーター
kawaz.apps.events.gcal.get_base_url()[ソース]
models Module
class kawaz.apps.events.models.Category(*args, **kwargs)[ソース]

ベースクラス: django.db.models.base.Model

イベントの大カテゴリ 運営が設置したものをユーザーが選ぶ

exception DoesNotExist

ベースクラス: django.core.exceptions.ObjectDoesNotExist

exception Category.MultipleObjectsReturned

ベースクラス: django.core.exceptions.MultipleObjectsReturned

Category.events

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Category.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Category.label

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Category.objects = <django.db.models.manager.Manager object>
Category.order

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class kawaz.apps.events.models.Event(id, pub_state, title, body, period_start, period_end, place, number_restriction, attendance_deadline, organizer, category, created_at, updated_at)[ソース]

ベースクラス: django.db.models.base.Model

exception DoesNotExist

ベースクラス: django.core.exceptions.ObjectDoesNotExist

exception Event.MultipleObjectsReturned

ベースクラス: django.core.exceptions.MultipleObjectsReturned

Event.active_attendees
Event.attend(user)[ソース]

指定されたユーザーをこのイベントに参加させる

Event.attendance_deadline

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Event.attendees

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

pizza.toppings and topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Event.body

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Event.category

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Event.category_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Event.clean()[ソース]

下記のルールに従ってValidationする 1. イベント終了時間は開始時間より遅い必要がある(時間は逆行できない) 2. 過去のイベントは作成できない(スネーク!タイムパラドックスだ!) 3. 7日以上にまたがるイベントは作成できない 4. 開始時間が指定されているが終了時間が指定されていないイベントは

作成できない(一生イベントに参加とかは物理的に不可能)
  1. 参加者制限が0人のイベントは作成できない
  2. 参加締め切りは未来でなければいけない
Event.created_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Event.get_absolute_url()[ソース]
Event.get_next_by_created_at(*moreargs, **morekwargs)
Event.get_next_by_updated_at(*moreargs, **morekwargs)
Event.get_previous_by_created_at(*moreargs, **morekwargs)
Event.get_previous_by_updated_at(*moreargs, **morekwargs)
Event.get_pub_state_display(*moreargs, **morekwargs)
Event.googlecalendarbridge

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

place.restaurant is a ReverseOneToOneDescriptor instance.

Event.humanized_period

開催日時をいい感じで描画します

Output:
5月10日(月) 13:00 ~ 19:00 2013年9月21(土) 13:00 ~ 19:00 6月11日(月) 13:00 ~ 6月12日(火) 10:00 未定 6月11日(月) 13:00 ~ 終了日時未定
Event.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Event.is_active()[ソース]

イベントが終了していないか否か

Event.is_attendee(user)[ソース]

参加者か否か

Event.is_over_deadline()[ソース]

参加締め切りを超えているか否か

Event.is_over_restriction()[ソース]

人数制限を超えているか否か

Event.number_restriction

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Event.objects = <kawaz.apps.events.models.EventManager object>
Event.organizer

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Event.organizer_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Event.period_end

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Event.period_start

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Event.place

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Event.pub_state

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Event.quit(user)[ソース]

指定されたユーザーをこのイベントから退会させる

Event.save(force_insert=False, force_update=False, using=None, update_fields=None)

Saves the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

Event.title

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Event.updated_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class kawaz.apps.events.models.EventManager[ソース]

ベースクラス: django.db.models.manager.Manager, kawaz.core.publishments.models.PublishmentManagerMixin

active(user)[ソース]

指定されたユーザーに公開されたイベントの中で、まだ終わっていない or イベントの終了時期が指定されていないかつ、作成日から30日日以内のイベントを含むクエリを返す

attendable(user)[ソース]

指定されたユーザーに公開されたイベントの中で、参加可能なイベントを 含むクエリを返す

author_field_name = 'organizer'
kawaz.apps.events.models.join_organizer(**kwargs)[ソース]

作成者を自動的に参加させるシグナルレシーバ

perms Module
class kawaz.apps.events.perms.EventPermissionLogic[ソース]

ベースクラス: permission.logics.base.PermissionLogic

Permission logic of Event model which for

  • events.add_event
  • events.change_event
  • events.delete_event
  • events.attend_event
  • events.quit_event
has_perm(user_obj, perm, obj=None)[ソース]

Check if user have a specified event permissions (of obj)

urls Module
views Module
class kawaz.apps.events.views.EventActiveQuerySetMixin[ソース]

ベースクラス: django.views.generic.list.MultipleObjectMixin

get_queryset()[ソース]
class kawaz.apps.events.views.EventAttendView(**kwargs)[ソース]

ベースクラス: django.views.generic.edit.UpdateView

attend(request, *args, **kwargs)[ソース]

Calls the attend() method on the fetched object and then redirects to the success URL.

dispatch(request, *args, **kwargs)
get(request, *args, **kwargs)[ソース]
get_success_url()[ソース]
model

Event のエイリアス

post(request, *args, **kwargs)[ソース]
class kawaz.apps.events.views.EventCalendarView(**kwargs)[ソース]

ベースクラス: django.views.generic.detail.DetailView

EventをiCal形式でダウンロードするView

MIMETYPE = 'text/calendar'
dispatch(request, *args, **kwargs)
model

Event のエイリアス

render_to_response(context, **response_kwargs)[ソース]
class kawaz.apps.events.views.EventCreateView(**kwargs)[ソース]

ベースクラス: django.contrib.messages.views.SuccessMessageMixin, django.views.generic.edit.CreateView

dispatch(request, *args, **kwargs)
form_class

EventCreationForm のエイリアス

form_valid(form)[ソース]
get_success_message(cleaned_data)[ソース]
model

Event のエイリアス

class kawaz.apps.events.views.EventDateArchiveMixin(**kwargs)[ソース]

ベースクラス: django.views.generic.dates.BaseArchiveIndexView

get(request, *args, **kwargs)[ソース]
class kawaz.apps.events.views.EventDeleteView(**kwargs)[ソース]

ベースクラス: kawaz.core.views.delete.DeleteSuccessMessageMixin, django.views.generic.edit.DeleteView

dispatch(request, *args, **kwargs)
get_success_message()[ソース]
model

Event のエイリアス

success_url = <django.utils.functional.lazy.<locals>.__proxy__ object>
class kawaz.apps.events.views.EventDetailView(**kwargs)[ソース]

ベースクラス: django.views.generic.detail.DetailView

dispatch(request, *args, **kwargs)
model

Event のエイリアス

class kawaz.apps.events.views.EventListView(**kwargs)[ソース]

ベースクラス: django_filters.views.FilterView, kawaz.apps.events.views.EventActiveQuerySetMixin

filterset_class

EventFilter のエイリアス

model

Event のエイリアス

template_name_suffix = '_list'
class kawaz.apps.events.views.EventMonthListView(**kwargs)[ソース]

ベースクラス: django.views.generic.dates.MonthArchiveView, kawaz.apps.events.views.EventPublishedQuerySetMixin, kawaz.apps.events.views.EventDateArchiveMixin

allow_empty = True
allow_future = True
date_field = 'period_start'
model

Event のエイリアス

month_format = '%m'
class kawaz.apps.events.views.EventPreviewView(**kwargs)[ソース]

ベースクラス: kawaz.core.views.preview.SingleObjectPreviewViewMixin, django.views.generic.detail.DetailView

model

Event のエイリアス

template_name = 'events/components/event_detail.html'
class kawaz.apps.events.views.EventPublishedQuerySetMixin[ソース]

ベースクラス: django.views.generic.list.MultipleObjectMixin

get_queryset()[ソース]
class kawaz.apps.events.views.EventQuitView(**kwargs)[ソース]

ベースクラス: django.views.generic.edit.UpdateView

dispatch(request, *args, **kwargs)
get(request, *args, **kwargs)[ソース]
get_success_url()[ソース]
model

Event のエイリアス

post(request, *args, **kwargs)[ソース]
quit(request, *args, **kwargs)[ソース]

Calls the quit() method on the fetched object and then redirects to the success URL.

class kawaz.apps.events.views.EventUpdateView(**kwargs)[ソース]

ベースクラス: django.contrib.messages.views.SuccessMessageMixin, django.views.generic.edit.UpdateView

dispatch(request, *args, **kwargs)
form_class

EventUpdateForm のエイリアス

get_success_message(cleaned_data)[ソース]
model

Event のエイリアス

class kawaz.apps.events.views.EventYearListView(**kwargs)[ソース]

ベースクラス: django.views.generic.dates.YearArchiveView, kawaz.apps.events.views.EventPublishedQuerySetMixin, kawaz.apps.events.views.EventDateArchiveMixin

allow_empty = True
allow_future = True
date_field = 'period_start'
make_object_list = True
model

Event のエイリアス

paginate_by = 10
Subpackages
migrations Package
0001_initial Module
class kawaz.apps.events.migrations.0001_initial.Migration(name, app_label)[ソース]

ベースクラス: django.db.migrations.migration.Migration

dependencies = [('personas', '__first__')]
operations = [<CreateModel options={'ordering': ('order',), 'verbose_name': 'Label', 'verbose_name_plural': 'Label'}, fields=[('id', <django.db.models.fields.AutoField>), ('label', <django.db.models.fields.CharField>), ('order', <django.db.models.fields.PositiveSmallIntegerField>)], bases=(<class 'django.db.models.base.Model'>,), name='Category'>, <CreateModel options={'ordering': ('period_start', 'period_end', '-created_at', '-updated_at', 'title', '-pk'), 'permissions': (('attend_event', 'Can attend the event'), ('quit_event', 'Can quit the event'), ('view_event', 'Can view the event')), 'verbose_name': 'Event', 'verbose_name_plural': 'Events'}, fields=[('id', <django.db.models.fields.AutoField>), ('pub_state', <django.db.models.fields.CharField>), ('title', <django.db.models.fields.CharField>), ('body', <django.db.models.fields.TextField>), ('period_start', <django.db.models.fields.DateTimeField>), ('period_end', <django.db.models.fields.DateTimeField>), ('place', <django.db.models.fields.CharField>), ('number_restriction', <django.db.models.fields.PositiveIntegerField>), ('attendance_deadline', <django.db.models.fields.DateTimeField>), ('created_at', <django.db.models.fields.DateTimeField>), ('updated_at', <django.db.models.fields.DateTimeField>), ('attendees', <django.db.models.fields.related.ManyToManyField>), ('category', <django.db.models.fields.related.ForeignKey>), ('organizer', <django.db.models.fields.related.ForeignKey>)], bases=(<class 'django.db.models.base.Model'>,), name='Event'>]
templatetags Package
events_tags Module
class kawaz.apps.events.templatetags.events_tags.Archive(date, object_list, count, url)[ソース]

ベースクラス: object

kawaz.apps.events.templatetags.events_tags.get_events(context, lookup='published')[ソース]

任意の<lookup>によりフィルタされた Event のクエリを取得し指定された <variable>に格納するテンプレートタグ

Syntax:
{% get_events as <variable> %} {% get_events <lookup> as <variable> %}
Lookup: (Default: published)
published: ユーザーに対して公開された Event を返す draft: ユーザーが編集可能な下書き Event を返す active: ユーザーが閲覧可能な非終了 Event を返す attendable: ユーザーが参加可能な Event を返す

Examples

公開された Event のクエリを取得し、最新5件のみを描画

{% get_events as events %} {% for event in events|slice:”:5” %}

{{ event }}

{% endfor %}

下書き記事を取得

{% get_events ‘draft’ as draft_events %}

kawaz.apps.events.templatetags.events_tags.get_monthly_archives(context)[ソース]

Eventの月間アーカイブを取得する

Usage:
get_monthly_archive as <variable>

<variable> には Archive の各インスタンスがリストとして保存される。 また Archive は下記に上げるアトリビュートを持っている

  • date (Date): アーカイブ対象のDateオブジェクト
  • object_list (QuerySet): アーカイブ対象のEventsを格納したQuerySet
  • count (int): アーカイブ対象のイベント数
  • url (str): アーカイブのURL

したがって下記のようにアーカイブリストを描画できる

{% get_monthly_archives as archives %} {% for archive in archives %}

<p><a href=”{{ archive.url }}”>
{{ archive.date }}({{ archive.count }})

</a></p>

{% endfor %}

tests Package
factories Module
test_activity Module
test_models Module
test_perms Module
test_templatetags Module
test_views Module
utils Module
utils Package
utils Package
ical Module
kawaz.apps.events.utils.ical.generate_ical(object)[ソース]
kfm Package
parser Module
kawaz.apps.kfm.parser.parse_kfm(value)[ソース]

Kawaz Flavored Markdown のパースを行いHTMLを返す

kfm は下記の機能を提供する

  • GitHub Flavored Markdown (2014) と等価の Markdown 機能 - Multiple underscores in words - URL autolinking - Strikethrough - Fenced code blocks - Syntax highlighting - Tables
  • 脚注シンタックスの追加
  • Cuddled Lists (パラグラフ直下でもリスト記法が有効)
  • YouTube URL のプレイヤー展開
  • ニコニコ動画URLのプレイヤー展開
  • @username のユーザーリンク展開 (Kawaz ユーザー)
  • {attachment: <slug>} の添付展開
Subpackages
extras Package
mention Module
kawaz.apps.kfm.extras.mention.parse_mentions(value)[ソース]

指定された文字列から @username という部分を探しリンク文字列に変換

nicovideo Module
kawaz.apps.kfm.extras.nicovideo.parse_nicovideo_urls(value)[ソース]

指定された文字列に含まれる ニコニコ動画 URL をプレイヤーに変換 ただしURLがシングル・ダブルクオーテーションマークで囲まれていた場合は 変換を行わない

変換にはテンプレートシステムが使用され kfm/parsers/nicovideo.html なおコンテキストとして下記の値がテンプレートに渡される

  • video_id: ニコニコ動画 ID
strikethrough Module
kawaz.apps.kfm.extras.strikethrough.parse_strikethroughs(value)[ソース]

~~で囲まれた部分を<del>展開する

utils Module
kawaz.apps.kfm.extras.utils.is_quoated(text, s, e, quotes=('"', "'", '`'))[ソース]

指定された文字列の特定部分がクオート文字で囲まれているか調べる

Ref: https://gist.github.com/lambdalisue/f2c9ab121883e48d3c2f

Examples

>>> #         0123456789012345678901234
>>> text = '''N'Y'N'Y'N"Y"N"Y'Y'Y"N"Y"N'''
>>> # N
>>> assert is_quoated(text, 0, 1) is False
>>> # N'
>>> assert is_quoated(text, 0, 2) is False
>>> # N'Y
>>> assert is_quoated(text, 0, 3) is False
>>> # N'Y'
>>> assert is_quoated(text, 0, 4) is False
>>> # '
>>> assert is_quoated(text, 1, 2) is False
>>> # 'Y
>>> assert is_quoated(text, 1, 3) is False
>>> # 'Y'
>>> assert is_quoated(text, 1, 4) is False
>>> # 'Y'N
>>> assert is_quoated(text, 1, 5) is False
>>> # Y
>>> assert is_quoated(text, 2, 3) is True
>>> # Y'
>>> assert is_quoated(text, 2, 4) is False
>>> # Y'N
>>> assert is_quoated(text, 2, 5) is False
>>> # Y'N'
>>> assert is_quoated(text, 2, 6) is True
>>> # Y'N'Y
>>> assert is_quoated(text, 2, 7) is True
>>> # Y'N'Y'
>>> assert is_quoated(text, 2, 8) is False
youtube Module
kawaz.apps.kfm.extras.youtube.parse_youtube_urls(value, responsive=False, width=None, height=None)[ソース]

指定された文字列に含まれる YouTube URL をプレイヤーに変換 ただしURLがシングル・ダブルクオーテーションマークで囲まれていた場合は 変換を行わない

変換にはテンプレートシステムが使用され kfm/parsers/youtube.html なおコンテキストとして下記の値がテンプレートに渡される

  • video_id: YouTube Video ID
  • responsive: レスポンシブデザインで描画すべきか否か
  • width: 横幅(responsiveには渡されない)
  • height: 縦幅(responsiveには渡されない)
パラメタ:
  • responsive (bool) – bootstrapのレスポンシブデザインに対応させる http://getbootstrap.com/components/#responsive-embed これが指定された場合下記 width/height の指定は無視される
  • width (int or None) – 横幅 (px) 指定されない場合は DEFAULT_WIDTH が使用される
  • height (int or None) – 縦幅 (px) 指定されない場合は width に対して アスペクト比が 16:9 に成るように自動指定される
templatetags Package
kfm Module
class kawaz.apps.kfm.templatetags.kfm.KFMNode(nodelist)[ソース]

ベースクラス: django.template.base.Node

render(context)[ソース]
kawaz.apps.kfm.templatetags.kfm.do_include_kfm(parser, token)[ソース]

テンプレートフォルダに存在する Kawaz Flavored Markdown ファイルを読み込み レンダリングするテンプレートタグ

Usage:

{% include_kfm “markdown/about.md” %}
kawaz.apps.kfm.templatetags.kfm.do_kfm(parser, token)[ソース]

ブロックで囲まれたテキストを Kawaz Flavored Markdown として HTML展開するタグ

Usage:
{% kfm %} Kawaz Flavored Markdown {% endkfm %}
kawaz.apps.kfm.templatetags.kfm.filter_kfm(value)[ソース]

指定されたテキストを Kawaz Flavored Markdown として HTML 展開するフィルタ

Usage:
{{ object.body | kfm }}
youtube Module
kawaz.apps.kfm.templatetags.youtube.filter_youtube(value, size=None)[ソース]

指定されたテキスト内に存在するYouTube URLを展開するフィルタ

Usage:
{{ object.body | youtube }} {{ object.body | youtube:’responsive’ }} # レスポンシブデザイン {{ object.body | youtube:‘1600’ }} # 横幅指定(16:9) {{ object.body | youtube:‘1600,900’ }} # 縦横幅指定
tests Package
test_parse Module
Subpackages
test_extras Package
test_mention Module
test_nicovideo Module
class kawaz.apps.kfm.tests.test_extras.test_nicovideo.ParseNicoVideoURLsTestCase(methodName='runTest')[ソース]

ベースクラス: django.test.testcases.TestCase

setUp()[ソース]
test_parse_nicovideo_urls()[ソース]

ニコニコ動画のURLは展開される

test_parse_nicovideo_urls_double_quoated()[ソース]

ダブルクォートされたニコニコ動画URLは展開されない

test_parse_nicovideo_urls_fenced()[ソース]

フェンス化されたニコニコ動画URLは展開されない

test_parse_nicovideo_urls_multiple()[ソース]

複数のニコニコ動画URLも正しく展開される

test_parse_nicovideo_urls_single_quoated()[ソース]

シングルクォートされたニコニコ動画URLは展開されない

test_strikethrough Module
class kawaz.apps.kfm.tests.test_extras.test_strikethrough.ParseStrikethroughsTestCase(methodName='runTest')[ソース]

ベースクラス: django.test.testcases.TestCase

test_parse_strikethroughs()[ソース]

打ち消し構文が正しく変換される

test_parse_strikethroughs_double_quoted()[ソース]

ダブルクォートされた打ち消し構文は変換されない

test_parse_strikethroughs_fenced()[ソース]

フェンス化された打ち消し構文は変換されない

test_parse_strikethroughs_multiple()[ソース]

複数の打ち消し構文が正しく変換される

test_parse_strikethroughs_single_quoted()[ソース]

シングルクォートされた打ち消し構文は変換されない

test_youtube Module
class kawaz.apps.kfm.tests.test_extras.test_youtube.ParseYouTubeURLsTestCase(methodName='runTest')[ソース]

ベースクラス: django.test.testcases.TestCase

setUp()[ソース]
test_parse_shorten_youtube_urls()[ソース]

短縮されたYouTubeのURLは展開される

test_parse_youtube_urls()[ソース]

YouTubeのURLは展開される

test_parse_youtube_urls_double_quoated()[ソース]

ダブルクォートされたYouTubeURLは展開されない

test_parse_youtube_urls_fenced()[ソース]

フェンス化されたYouTubeURLは展開されない

test_parse_youtube_urls_height()[ソース]

YouTubeのURLは展開される (Height指定)

test_parse_youtube_urls_multiple()[ソース]

複数のYouTubeURLも正しく展開される

test_parse_youtube_urls_responsive()[ソース]

YouTubeのURLはレスポンシブ展開される

test_parse_youtube_urls_single_quoated()[ソース]

シングルクォートされたYouTubeURLは展開されない

test_parse_youtube_urls_width()[ソース]

YouTubeのURLは展開される (Width指定)

test_templatetags Package
test_youtube Module
class kawaz.apps.kfm.tests.test_templatetags.test_youtube.YouTubeTemplateTagTestCase(methodName='runTest')[ソース]

ベースクラス: django.test.testcases.TestCase

test_youtube(parse_youtube_urls)[ソース]

フィルタによりYouTube展開コードが呼び出される

test_youtube_responsive(parse_youtube_urls)[ソース]

フィルタによりYouTube展開コードが呼び出される (responsive)

test_youtube_width(parse_youtube_urls)[ソース]

フィルタによりYouTube展開コードが呼び出される (width)

test_youtube_width_and_height(parse_youtube_urls)[ソース]

フィルタによりYouTube展開コードが呼び出される (width/height)

products Package
activity Module
class kawaz.apps.products.activity.ProductActivityMediator[ソース]

ベースクラス: activities.mediator.ActivityMediator

alter(instance, activity, **kwargs)[ソース]
notifiers = ('twitter_kawaz_info', 'twitter_kawaz_official')
prepare_context(activity, context, typename=None)[ソース]
class kawaz.apps.products.activity.ReleaseActivityMediator[ソース]

ベースクラス: activities.mediator.ActivityMediator

alter(instance, activity, **kwargs)[ソース]
class kawaz.apps.products.activity.ScreenshotActivityMediator[ソース]

ベースクラス: activities.mediator.ActivityMediator

alter(instance, activity, **kwargs)[ソース]
admin Module
class kawaz.apps.products.admin.CategoryAdmin(model, admin_site)[ソース]

ベースクラス: django.contrib.admin.options.ModelAdmin

media
class kawaz.apps.products.admin.PackageReleaseAdmin(model, admin_site)[ソース]

ベースクラス: django.contrib.admin.options.ModelAdmin

list_display = ('label', 'platform', 'version', 'downloads')
media
readonly_fields = ('downloads',)
search_fields = ('title', 'description')
class kawaz.apps.products.admin.PlatformAdmin(model, admin_site)[ソース]

ベースクラス: django.contrib.admin.options.ModelAdmin

media
class kawaz.apps.products.admin.ProductAdmin(model, admin_site)[ソース]

ベースクラス: django.contrib.admin.options.ModelAdmin

last_modifier_nickname(obj)[ソース]
list_display = ('title', 'last_modifier_nickname', 'get_display_mode_display', 'published_at', 'created_at', 'updated_at')
media
class kawaz.apps.products.admin.ScreenshotAdmin(model, admin_site)[ソース]

ベースクラス: django.contrib.admin.options.ModelAdmin

media
class kawaz.apps.products.admin.URLReleaseAdmin(model, admin_site)[ソース]

ベースクラス: django.contrib.admin.options.ModelAdmin

list_display = ('label', 'platform', 'version', 'url', 'pageview')
media
readonly_fields = ('pageview',)
filters Module
class kawaz.apps.products.filters.PlatformListGroupLinkWidget(attrs=None, choices=())[ソース]

ベースクラス: kawaz.core.filters.widgets.ListGroupLinkWidget

プラットフォームアイコンを一覧に出すWidget

media
option_string()[ソース]
render_option(name, selected_choices, option_value, option_label)[ソース]

各要素のタグを描画している BootstrapのListGroupを使用するために以下のようなタグを吐く

<a class=”list-group-item” href=”?platform=1”><img class=”platform-icon” src=”/icon/windows.png”>Windows(10)</a>

render_options(choices, selected_choices, name)[ソース]
class kawaz.apps.products.filters.ProductFilter(data=None, queryset=None, prefix=None, strict=None, request=None)[ソース]

ベースクラス: django_filters.filterset.FilterSet

class Meta[ソース]

ベースクラス: object

fields = ['platforms', 'categories']
model

Product のエイリアス

ProductFilter.base_filters = OrderedDict([('platforms', <django_filters.filters.ModelChoiceFilter object at 0x7fb59ec7b630>), ('categories', <django_filters.filters.ModelChoiceFilter object at 0x7fb59ec7bf60>)])
ProductFilter.declared_filters = OrderedDict([('platforms', <django_filters.filters.ModelChoiceFilter object at 0x7fb59ec7b630>), ('categories', <django_filters.filters.ModelChoiceFilter object at 0x7fb59ec7bf60>)])
forms Module
class kawaz.apps.products.forms.PackageReleaseForm(*args, **kwargs)[ソース]

ベースクラス: kawaz.core.forms.mixins.Bootstrap3InlineFormHelperMixin, django.forms.models.ModelForm

class Meta[ソース]

ベースクラス: object

fields = ('label', 'platform', 'version', 'file_content')
model

PackageRelease のエイリアス

PackageReleaseForm.base_fields = OrderedDict([('label', <django.forms.fields.CharField object at 0x7fb59ebaba58>), ('platform', <django.forms.models.ModelChoiceField object at 0x7fb59ebb74e0>), ('version', <django.forms.fields.CharField object at 0x7fb59ec68438>), ('file_content', <django.forms.fields.FileField object at 0x7fb59ec31208>)])
PackageReleaseForm.declared_fields = OrderedDict()
PackageReleaseForm.form_tag = False
PackageReleaseForm.media
class kawaz.apps.products.forms.ProductBaseForm(*args, **kwargs)[ソース]

ベースクラス: kawaz.core.forms.mixins.Bootstrap3HorizontalFormHelperMixin, django.forms.models.ModelForm

class Meta[ソース]

ベースクラス: object

exclude = ()
model

Product のエイリアス

ProductBaseForm.base_fields = OrderedDict([('title', <django.forms.fields.CharField object at 0x7fb59ebabe10>), ('slug', <django.forms.fields.SlugField object at 0x7fb59ebabba8>), ('thumbnail', <django.forms.fields.ImageField object at 0x7fb59ebab128>), ('description', <kawaz.core.forms.fields.MarkdownField object at 0x7fb59ec624e0>), ('advertisement_image', <django.forms.fields.ImageField object at 0x7fb59ebab9b0>), ('trailer', <django.forms.fields.URLField object at 0x7fb59ebab828>), ('project', <django.forms.models.ModelChoiceField object at 0x7fb59ec623c8>), ('platforms', <django.forms.models.ModelMultipleChoiceField object at 0x7fb59ec62e10>), ('categories', <django.forms.models.ModelMultipleChoiceField object at 0x7fb59ec627b8>), ('contact_info', <django.forms.fields.CharField object at 0x7fb59f3018d0>), ('published_at', <django.forms.fields.DateField object at 0x7fb59ec629e8>), ('administrators', <kawaz.core.personas.forms.persona.PersonaChoiceField object at 0x7fb59ec62a90>), ('display_mode', <django.forms.fields.TypedChoiceField object at 0x7fb59ec7cba8>)])
ProductBaseForm.declared_fields = OrderedDict([('description', <kawaz.core.forms.fields.MarkdownField object at 0x7fb59ec624e0>), ('project', <django.forms.models.ModelChoiceField object at 0x7fb59ec623c8>), ('platforms', <django.forms.models.ModelMultipleChoiceField object at 0x7fb59ec62e10>), ('categories', <django.forms.models.ModelMultipleChoiceField object at 0x7fb59ec627b8>), ('administrators', <kawaz.core.personas.forms.persona.PersonaChoiceField object at 0x7fb59ec62a90>), ('published_at', <django.forms.fields.DateField object at 0x7fb59ec629e8>)])
ProductBaseForm.form_tag = False
ProductBaseForm.get_additional_objects()[ソース]
ProductBaseForm.media
class kawaz.apps.products.forms.ProductCreateForm(*args, **kwargs)[ソース]

ベースクラス: kawaz.apps.products.forms.ProductBaseForm

class Meta[ソース]

ベースクラス: kawaz.apps.products.forms.Meta

exclude = ('display_mode',)
ProductCreateForm.base_fields = OrderedDict([('title', <django.forms.fields.CharField object at 0x7fb59ebab2b0>), ('slug', <django.forms.fields.SlugField object at 0x7fb59ec7c780>), ('thumbnail', <django.forms.fields.ImageField object at 0x7fb59ec7cf60>), ('description', <kawaz.core.forms.fields.MarkdownField object at 0x7fb59ec624e0>), ('advertisement_image', <django.forms.fields.ImageField object at 0x7fb59ec7c1d0>), ('trailer', <django.forms.fields.URLField object at 0x7fb59ec7c588>), ('project', <django.forms.models.ModelChoiceField object at 0x7fb59ec623c8>), ('platforms', <django.forms.models.ModelMultipleChoiceField object at 0x7fb59ec62e10>), ('categories', <django.forms.models.ModelMultipleChoiceField object at 0x7fb59ec627b8>), ('contact_info', <django.forms.fields.CharField object at 0x7fb59f301ba8>), ('published_at', <django.forms.fields.DateField object at 0x7fb59ec629e8>), ('administrators', <kawaz.core.personas.forms.persona.PersonaChoiceField object at 0x7fb59ec62a90>)])
ProductCreateForm.declared_fields = OrderedDict([('description', <kawaz.core.forms.fields.MarkdownField object at 0x7fb59ec624e0>), ('project', <django.forms.models.ModelChoiceField object at 0x7fb59ec623c8>), ('platforms', <django.forms.models.ModelMultipleChoiceField object at 0x7fb59ec62e10>), ('categories', <django.forms.models.ModelMultipleChoiceField object at 0x7fb59ec627b8>), ('administrators', <kawaz.core.personas.forms.persona.PersonaChoiceField object at 0x7fb59ec62a90>), ('published_at', <django.forms.fields.DateField object at 0x7fb59ec629e8>)])
ProductCreateForm.media
class kawaz.apps.products.forms.ProductUpdateForm(*args, **kwargs)[ソース]

ベースクラス: kawaz.apps.products.forms.ProductBaseForm

class Meta[ソース]

ベースクラス: kawaz.apps.products.forms.Meta

exclude = ('slug', 'display_mode')
ProductUpdateForm.base_fields = OrderedDict([('title', <django.forms.fields.CharField object at 0x7fb59ec7c080>), ('thumbnail', <django.forms.fields.ImageField object at 0x7fb59ebab7b8>), ('description', <kawaz.core.forms.fields.MarkdownField object at 0x7fb59ec624e0>), ('advertisement_image', <django.forms.fields.ImageField object at 0x7fb59ec62438>), ('trailer', <django.forms.fields.URLField object at 0x7fb59ec62278>), ('project', <django.forms.models.ModelChoiceField object at 0x7fb59ec623c8>), ('platforms', <django.forms.models.ModelMultipleChoiceField object at 0x7fb59ec62e10>), ('categories', <django.forms.models.ModelMultipleChoiceField object at 0x7fb59ec627b8>), ('contact_info', <django.forms.fields.CharField object at 0x7fb59eb9e438>), ('published_at', <django.forms.fields.DateField object at 0x7fb59ec629e8>), ('administrators', <kawaz.core.personas.forms.persona.PersonaChoiceField object at 0x7fb59ec62a90>)])
ProductUpdateForm.declared_fields = OrderedDict([('description', <kawaz.core.forms.fields.MarkdownField object at 0x7fb59ec624e0>), ('project', <django.forms.models.ModelChoiceField object at 0x7fb59ec623c8>), ('platforms', <django.forms.models.ModelMultipleChoiceField object at 0x7fb59ec62e10>), ('categories', <django.forms.models.ModelMultipleChoiceField object at 0x7fb59ec627b8>), ('administrators', <kawaz.core.personas.forms.persona.PersonaChoiceField object at 0x7fb59ec62a90>), ('published_at', <django.forms.fields.DateField object at 0x7fb59ec629e8>)])
ProductUpdateForm.media
class kawaz.apps.products.forms.ScreenshotForm(*args, **kwargs)[ソース]

ベースクラス: kawaz.core.forms.mixins.Bootstrap3InlineFormHelperMixin, django.forms.models.ModelForm

class Meta[ソース]

ベースクラス: object

fields = ('image',)
model

Screenshot のエイリアス

ScreenshotForm.base_fields = OrderedDict([('image', <django.forms.fields.ImageField object at 0x7fb59eb9e668>)])
ScreenshotForm.declared_fields = OrderedDict()
ScreenshotForm.form_tag = False
ScreenshotForm.media
class kawaz.apps.products.forms.URLReleaseForm(*args, **kwargs)[ソース]

ベースクラス: kawaz.core.forms.mixins.Bootstrap3InlineFormHelperMixin, django.forms.models.ModelForm

class Meta[ソース]

ベースクラス: object

fields = ('label', 'platform', 'version', 'url')
model

URLRelease のエイリアス

URLReleaseForm.base_fields = OrderedDict([('label', <django.forms.fields.CharField object at 0x7fb59ec31cc0>), ('platform', <django.forms.models.ModelChoiceField object at 0x7fb59f8977f0>), ('version', <django.forms.fields.CharField object at 0x7fb59ec64470>), ('url', <django.forms.fields.URLField object at 0x7fb59ec649e8>)])
URLReleaseForm.declared_fields = OrderedDict()
URLReleaseForm.form_tag = False
URLReleaseForm.media
models Module
class kawaz.apps.products.models.AbstractRelease(*args, **kwargs)[ソース]

ベースクラス: django.db.models.base.Model

リリース形態のアブストラクトモデル

class Meta[ソース]

ベースクラス: object

abstract = False
ordering = ('platform__pk', 'product__pk')
AbstractRelease.created_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

AbstractRelease.get_next_by_created_at(*moreargs, **morekwargs)
AbstractRelease.get_next_by_updated_at(*moreargs, **morekwargs)
AbstractRelease.get_previous_by_created_at(*moreargs, **morekwargs)
AbstractRelease.get_previous_by_updated_at(*moreargs, **morekwargs)
AbstractRelease.label

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

AbstractRelease.platform

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

AbstractRelease.platform_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

AbstractRelease.product

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

AbstractRelease.product_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

AbstractRelease.updated_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

AbstractRelease.version

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class kawaz.apps.products.models.Category(*args, **kwargs)[ソース]

ベースクラス: django.db.models.base.Model

プロダクトが所属するカテゴリーを表すモデル

e.g. ACT, STG, ADV など

exception DoesNotExist

ベースクラス: django.core.exceptions.ObjectDoesNotExist

exception Category.MultipleObjectsReturned

ベースクラス: django.core.exceptions.MultipleObjectsReturned

Category.description

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Category.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Category.label

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Category.objects = <django.db.models.manager.Manager object>
Category.order

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Category.product_set

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

pizza.toppings and topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class kawaz.apps.products.models.PackageRelease(*args, **kwargs)[ソース]

ベースクラス: kawaz.apps.products.models.AbstractRelease

ファイル添付形式でのリリースモデル

exception DoesNotExist

ベースクラス: django.core.exceptions.ObjectDoesNotExist

exception PackageRelease.MultipleObjectsReturned

ベースクラス: django.core.exceptions.MultipleObjectsReturned

PackageRelease.downloads

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

PackageRelease.file_content

The descriptor for the file attribute on the model instance. Returns a FieldFile when accessed so you can do stuff like:

>>> from myapp.models import MyModel
>>> instance = MyModel.objects.get(pk=1)
>>> instance.file.size

Assigns a file object on assignment so you can do:

>>> with open('/path/to/hello.world', 'r') as f:
...     instance.file = File(f)
PackageRelease.filename

ファイル名を返します

PackageRelease.get_absolute_url()[ソース]
PackageRelease.get_next_by_created_at(*moreargs, **morekwargs)
PackageRelease.get_next_by_updated_at(*moreargs, **morekwargs)
PackageRelease.get_previous_by_created_at(*moreargs, **morekwargs)
PackageRelease.get_previous_by_updated_at(*moreargs, **morekwargs)
PackageRelease.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

PackageRelease.mimetype

Mimetypeを返します

PackageRelease.objects = <django.db.models.manager.Manager object>
PackageRelease.platform

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

PackageRelease.product

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

class kawaz.apps.products.models.Platform(*args, **kwargs)[ソース]

ベースクラス: django.db.models.base.Model

プロダクトがサポートしているプラットフォームを表すモデル

e.g. Windows, Mac, Browser, iOS, PS Vita など

exception DoesNotExist

ベースクラス: django.core.exceptions.ObjectDoesNotExist

exception Platform.MultipleObjectsReturned

ベースクラス: django.core.exceptions.MultipleObjectsReturned

Platform.icon

Just like the FileDescriptor, but for ImageFields. The only difference is assigning the width/height to the width_field/height_field, if appropriate.

Platform.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Platform.label

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Platform.objects = <django.db.models.manager.Manager object>
Platform.order

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Platform.packagerelease_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Platform.products

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

pizza.toppings and topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Platform.urlrelease_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class kawaz.apps.products.models.Product(*args, **kwargs)[ソース]

ベースクラス: django.db.models.base.Model

完成したプロダクトを表すモデル

メンバーであれば誰でも作成・管理可能

DISPLAY_MODES = (('featured', <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7fb59fd02dd8>), ('tiled', <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7fb59fd02f60>), ('normal', <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7fb59fd02f98>))
exception DoesNotExist

ベースクラス: django.core.exceptions.ObjectDoesNotExist

exception Product.MultipleObjectsReturned

ベースクラス: django.core.exceptions.MultipleObjectsReturned

Product.administrators

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

pizza.toppings and topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Product.advertisement_image

Enhanced ImageFileDescriptor

Just like the ImageFileDescriptor, but for ThumbnailField. The only difference is removing previous Image and Thumbnails from storage when the value has changed.

Product.categories

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

pizza.toppings and topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Product.clean()[ソース]
Product.contact_info

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Product.created_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Product.description

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Product.display_mode

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Product.get_absolute_url()[ソース]
Product.get_display_mode_display(*moreargs, **morekwargs)
Product.get_next_by_created_at(*moreargs, **morekwargs)
Product.get_next_by_published_at(*moreargs, **morekwargs)
Product.get_next_by_updated_at(*moreargs, **morekwargs)
Product.get_previous_by_created_at(*moreargs, **morekwargs)
Product.get_previous_by_published_at(*moreargs, **morekwargs)
Product.get_previous_by_updated_at(*moreargs, **morekwargs)
Product.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Product.join(user)[ソース]

指定されたユーザーを管理者にする

ユーザーに参加権限がない場合は PermissionDenied を投げる

Product.last_modifier

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Product.last_modifier_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Product.objects = <django.db.models.manager.Manager object>
Product.packagereleases

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Product.platforms

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

pizza.toppings and topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Product.project

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Product.project_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Product.published_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Product.quit(user)[ソース]

指定されたユーザーを管理者から外す

ユーザーに脱退権限がない場合は PermissionDenied を投げる

Product.save(force_insert=False, force_update=False, using=None, update_fields=None)

Saves the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

Product.screenshots

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Product.slug

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Product.thumbnail

Enhanced ImageFileDescriptor

Just like the ImageFileDescriptor, but for ThumbnailField. The only difference is removing previous Image and Thumbnails from storage when the value has changed.

Product.title

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Product.trailer

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Product.updated_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Product.urlreleases

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class kawaz.apps.products.models.Screenshot(*args, **kwargs)[ソース]

ベースクラス: django.db.models.base.Model

プロダクトのスクリーンショットモデル

プロダクト管理者は何枚でもプロダクトに関連付けることが出来る

exception DoesNotExist

ベースクラス: django.core.exceptions.ObjectDoesNotExist

exception Screenshot.MultipleObjectsReturned

ベースクラス: django.core.exceptions.MultipleObjectsReturned

Screenshot.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Screenshot.image

Enhanced ImageFileDescriptor

Just like the ImageFileDescriptor, but for ThumbnailField. The only difference is removing previous Image and Thumbnails from storage when the value has changed.

Screenshot.objects = <django.db.models.manager.Manager object>
Screenshot.product

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Screenshot.product_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class kawaz.apps.products.models.URLRelease(*args, **kwargs)[ソース]

ベースクラス: kawaz.apps.products.models.AbstractRelease

URL指定形式でのリリースモデル。主に外部ホスティングでのリリース用

e.g. iTunes App Store, Google Play, Vector など

exception DoesNotExist

ベースクラス: django.core.exceptions.ObjectDoesNotExist

exception URLRelease.MultipleObjectsReturned

ベースクラス: django.core.exceptions.MultipleObjectsReturned

URLRelease.PLAY_NOW_PLATFORM_LABELS = ['ブラウザ']
URLRelease.app_id

そのリリースがiOSアプリかAndroidアプリだった場合は、そのアプリのAppIDを取得して返します そうではない場合、空白文字を返します

URLRelease.get_absolute_url()[ソース]
URLRelease.get_next_by_created_at(*moreargs, **morekwargs)
URLRelease.get_next_by_updated_at(*moreargs, **morekwargs)
URLRelease.get_previous_by_created_at(*moreargs, **morekwargs)
URLRelease.get_previous_by_updated_at(*moreargs, **morekwargs)
URLRelease.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

URLRelease.is_appstore

App Store の URL か否か

URLRelease.is_googleplay

Google Play の URL か否か

URLRelease.is_play_now()[ソース]
URLRelease.objects = <django.db.models.manager.Manager object>
URLRelease.pageview

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

URLRelease.platform

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

URLRelease.product

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

URLRelease.url

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class kawaz.apps.products.models.UnsavedForeignKey(to, on_delete=None, related_name=None, related_query_name=None, limit_choices_to=None, parent_link=False, to_field=None, db_constraint=True, **kwargs)[ソース]

ベースクラス: django.db.models.fields.related.ForeignKey

allow_unsaved_instance_assignment = True
perms Module
class kawaz.apps.products.perms.ProductPermissionLogic[ソース]

ベースクラス: permission.logics.base.PermissionLogic

allowed_permissions = ('products.add_product', 'products.change_product', 'products.delete_product', 'products.join_product', 'products.quit_product')
has_perm(user_obj, perm, obj=None)[ソース]
urls Module
views Module
class kawaz.apps.products.views.PackageReleaseDetailView(**kwargs)[ソース]

ベースクラス: django.views.generic.detail.DetailView

get(request, *args, **kwargs)[ソース]
model

PackageRelease のエイリアス

class kawaz.apps.products.views.ProductCreateView(**kwargs)[ソース]

ベースクラス: kawaz.apps.products.views.ProductFormMixin, django.views.generic.edit.CreateView

dispatch(request, *args, **kwargs)
form_class

ProductCreateForm のエイリアス

form_valid(*args, **kwargs)[ソース]
get(request, *args, **kwargs)[ソース]
get_form(form_class=<class 'kawaz.apps.products.forms.ProductCreateForm'>)[ソース]
get_success_message(cleaned_data)[ソース]
model

Product のエイリアス

post(request, *args, **kwargs)[ソース]
class kawaz.apps.products.views.ProductDeleteView(**kwargs)[ソース]

ベースクラス: kawaz.core.views.delete.DeleteSuccessMessageMixin, django.views.generic.edit.DeleteView

dispatch(request, *args, **kwargs)
get_success_message()[ソース]
model

Product のエイリアス

success_url = <django.utils.functional.lazy.<locals>.__proxy__ object>
class kawaz.apps.products.views.ProductDetailView(**kwargs)[ソース]

ベースクラス: django.views.generic.detail.DetailView

model

Product のエイリアス

class kawaz.apps.products.views.ProductFormMixin[ソース]

ベースクラス: django.contrib.messages.views.SuccessMessageMixin

form_invalid(form, url_release_formset, package_release_formset, screenshot_formset)[ソース]
form_valid(form, url_release_formset, package_release_formset, screenshot_formset)[ソース]
get(request, *args, **kwargs)[ソース]
get_form_kwargs()[ソース]
get_package_release_formset()[ソース]
get_screenshot_formset()[ソース]
get_url_release_formset()[ソース]
post(request, *args, **kwargs)[ソース]
class kawaz.apps.products.views.ProductListView(**kwargs)[ソース]

ベースクラス: django_filters.views.FilterView

filterset_class

ProductFilter のエイリアス

model

Product のエイリアス

paginate_by = 20
template_name_suffix = '_list'
class kawaz.apps.products.views.ProductPreviewView(**kwargs)[ソース]

ベースクラス: kawaz.core.views.preview.SingleObjectPreviewViewMixin, django.views.generic.detail.DetailView

model

Product のエイリアス

template_name = 'products/components/product_detail.html'
class kawaz.apps.products.views.ProductUpdateView(**kwargs)[ソース]

ベースクラス: kawaz.apps.products.views.ProductFormMixin, django.views.generic.edit.UpdateView

dispatch(request, *args, **kwargs)
form_class

ProductUpdateForm のエイリアス

get(request, *args, **kwargs)[ソース]
get_success_message(cleaned_data)[ソース]
model

Product のエイリアス

post(request, *args, **kwargs)[ソース]
class kawaz.apps.products.views.URLReleaseDetailView(**kwargs)[ソース]

ベースクラス: django.views.generic.detail.DetailView

get(request, *args, **kwargs)[ソース]
model

URLRelease のエイリアス

Subpackages
migrations Package
0001_initial Module
class kawaz.apps.products.migrations.0001_initial.Migration(name, app_label)[ソース]

ベースクラス: django.db.migrations.migration.Migration

dependencies = [('personas', '__first__'), ('projects', '0001_initial')]
operations = [<CreateModel options={'ordering': ('order', 'pk'), 'verbose_name': 'Category', 'verbose_name_plural': 'Categories'}, fields=[('id', <django.db.models.fields.AutoField>), ('label', <django.db.models.fields.CharField>), ('description', <django.db.models.fields.CharField>), ('order', <django.db.models.fields.PositiveSmallIntegerField>)], bases=(<class 'django.db.models.base.Model'>,), name='Category'>, <CreateModel options={'ordering': ('platform__pk', 'product__pk'), 'abstract': False, 'verbose_name': 'Package release', 'verbose_name_plural': 'Package releases'}, fields=[('id', <django.db.models.fields.AutoField>), ('label', <django.db.models.fields.CharField>), ('version', <django.db.models.fields.CharField>), ('created_at', <django.db.models.fields.DateTimeField>), ('updated_at', <django.db.models.fields.DateTimeField>), ('file_content', <django.db.models.fields.files.FileField>), ('downloads', <django.db.models.fields.PositiveIntegerField>)], bases=(<class 'django.db.models.base.Model'>,), name='PackageRelease'>, <CreateModel options={'ordering': ('order', 'pk'), 'verbose_name': 'Platform', 'verbose_name_plural': 'Platforms'}, fields=[('id', <django.db.models.fields.AutoField>), ('label', <django.db.models.fields.CharField>), ('icon', <django.db.models.fields.files.ImageField>), ('order', <django.db.models.fields.PositiveSmallIntegerField>)], bases=(<class 'django.db.models.base.Model'>,), name='Platform'>, <CreateModel options={'ordering': ('display_mode', '-publish_at'), 'permissions': (('join_product', 'Can join to the product'), ('quit_product', 'Can quit from the product')), 'verbose_name': 'Product', 'verbose_name_plural': 'Products'}, fields=[('id', <django.db.models.fields.AutoField>), ('title', <django.db.models.fields.CharField>), ('slug', <django.db.models.fields.SlugField>), ('thumbnail', <thumbnailfield.fields.ThumbnailField>), ('description', <django.db.models.fields.TextField>), ('advertisement_image', <thumbnailfield.fields.ThumbnailField>), ('trailer', <django.db.models.fields.URLField>), ('publish_at', <django.db.models.fields.DateField>), ('created_at', <django.db.models.fields.DateTimeField>), ('updated_at', <django.db.models.fields.DateTimeField>), ('display_mode', <django.db.models.fields.CharField>), ('administrators', <django.db.models.fields.related.ManyToManyField>), ('categories', <django.db.models.fields.related.ManyToManyField>), ('last_modifier', <django.db.models.fields.related.ForeignKey>), ('platforms', <django.db.models.fields.related.ManyToManyField>), ('project', <django.db.models.fields.related.OneToOneField>)], bases=(<class 'django.db.models.base.Model'>,), name='Product'>, <CreateModel options={'ordering': ('pk',), 'verbose_name': 'Screen shot', 'verbose_name_plural': 'Screen shots'}, fields=[('id', <django.db.models.fields.AutoField>), ('image', <thumbnailfield.fields.ThumbnailField>), ('product', <django.db.models.fields.related.ForeignKey>)], bases=(<class 'django.db.models.base.Model'>,), name='Screenshot'>, <CreateModel options={'ordering': ('platform__pk', 'product__pk'), 'abstract': False, 'verbose_name': 'URL release', 'verbose_name_plural': 'URL releases'}, fields=[('id', <django.db.models.fields.AutoField>), ('label', <django.db.models.fields.CharField>), ('version', <django.db.models.fields.CharField>), ('created_at', <django.db.models.fields.DateTimeField>), ('updated_at', <django.db.models.fields.DateTimeField>), ('url', <django.db.models.fields.URLField>), ('pageview', <django.db.models.fields.PositiveIntegerField>), ('platform', <django.db.models.fields.related.ForeignKey>), ('product', <django.db.models.fields.related.ForeignKey>)], bases=(<class 'django.db.models.base.Model'>,), name='URLRelease'>, <AddField preserve_default=True, model_name='packagerelease', name='platform', field=<django.db.models.fields.related.ForeignKey>>, <AddField preserve_default=True, model_name='packagerelease', name='product', field=<django.db.models.fields.related.ForeignKey>>]
0002_auto_20141115_1411 Module
class kawaz.apps.products.migrations.0002_auto_20141115_1411.Migration(name, app_label)[ソース]

ベースクラス: django.db.migrations.migration.Migration

dependencies = [('products', '0001_initial')]
operations = [<AddField preserve_default=True, model_name='product', name='contact_info', field=<django.db.models.fields.CharField>>, <AlterField preserve_default=True, model_name='packagerelease', name='version', field=<django.db.models.fields.CharField>>, <AlterField preserve_default=True, model_name='urlrelease', name='version', field=<django.db.models.fields.CharField>>]
0003_auto_20141123_0104 Module
class kawaz.apps.products.migrations.0003_auto_20141123_0104.Migration(name, app_label)[ソース]

ベースクラス: django.db.migrations.migration.Migration

dependencies = [('products', '0002_auto_20141115_1411')]
operations = [<AlterModelOptions options={'ordering': ('display_mode', '-published_at'), 'permissions': (('join_product', 'Can join to the product'), ('quit_product', 'Can quit from the product')), 'verbose_name': 'Product', 'verbose_name_plural': 'Products'}, name='product'>, <RenameField model_name='product', old_name='publish_at', new_name='published_at'>, <AlterField preserve_default=True, model_name='product', name='contact_info', field=<django.db.models.fields.CharField>>]
templatetags Package
products_tags Module
kawaz.apps.products.templatetags.products_tags.get_categories()[ソース]

全てのCategory一覧を取り出します。

Syntax:
{% get_categories as <variable> %}
kawaz.apps.products.templatetags.products_tags.get_platforms()[ソース]

全てのPlatform一覧を取り出します。

Syntax:
{% get_platforms as <variable> %}
kawaz.apps.products.templatetags.products_tags.get_products(lookup='mixed')[ソース]

任意の<lookup>によりフィルタされた Product のクエリを取得し指定された <variable>に格納するテンプレートタグ

Syntax:
{% get_products as <variable> %} {% get_products <lookup> as <variable> %}
Lookup: (Default: mixed)
mixed: display_mode が featured/tiled な Product を返す normal: display_mode が normal な Product を返す featured: display_mode が featured な Product を返す tiled: display_mode が tiled な Product を返す

Examples

display_mode が featured/tiled な Product のクエリを取得し、最新 5件のみを描画

{% get_products as products %} {% for product in products|slice:”:5” %}

{{ product }}

{% endfor %}

display_mode が normal な Product を取得

{% get_products ‘normal’ as normal_products %}

kawaz.apps.products.templatetags.products_tags.get_products_by_categories(categories)[ソース]

任意のカテゴリに所属するProductを返却します

categories:
CategoryのQuerySet

Example

{% load products_tag %} {% get_product_by_category <categories> as <variable> %}

kawaz.apps.products.templatetags.products_tags.get_relative(product)[ソース]

任意のプロダクトの関連プロダクトを取り出します。 渡されたプロダクトと同じカテゴリに所属している物全てから、自身を抜いた QuerySetを返します

Syntax:
{% get_relative <product> as <variable> %}
kawaz.apps.products.templatetags.products_tags.render_twitter_card(context, product)[ソース]

プロダクト用のTwitterカードを埋め込むテンプレートタグ 通常はhead内に書く

Syntax:
{% render_twitter_card product %}
Template:

products/components/twitter_card.htmlが使用される。 このテンプレートは以下のコンテキストを受け取れる

product: 描画対象のProductオブジェクト apps: Productの所属するURLReleaseのうち、iOSアプリ、Androidアプリのもののみが含まれたリスト

このような仕様になっているのは、appsがある場合のみTwitterカードのApp Cardを利用することが想定されているためである

tests Package
tests Package
factories Module
test_activity Module
test_models Module
test_perms Module
test_templatetags Module
test_views Module
projects Package
projects Package
activity Module
class kawaz.apps.projects.activity.ProjectActivityMediator[ソース]

ベースクラス: activities.mediator.ActivityMediator

alter(instance, activity, **kwargs)[ソース]
m2m_fields = ('members',)
prepare_context(activity, context, typename=None)[ソース]
admin Module
class kawaz.apps.projects.admin.CategoryAdmin(model, admin_site)[ソース]

ベースクラス: django.contrib.admin.options.ModelAdmin

media
class kawaz.apps.projects.admin.ProjectAdmin(model, admin_site)[ソース]

ベースクラス: django.contrib.admin.options.ModelAdmin

static administrator_nickname(obj)[ソース]
static is_legacy(obj)[ソース]
list_display = ('title', 'get_status_display', 'administrator_nickname', 'created_at', 'updated_at', 'is_legacy')
media
search_fields = ('title', 'body', 'administrator__username', 'administrator__nickname', 'category__label')
forms Module
class kawaz.apps.projects.forms.ProjectCreateForm(*args, **kwargs)[ソース]

ベースクラス: kawaz.core.forms.mixins.Bootstrap3HorizontalFormHelperMixin, django.forms.models.ModelForm

class Meta[ソース]

ベースクラス: object

exclude = ('administrator', 'members', 'created_at', 'updated_at')
model

Project のエイリアス

ProjectCreateForm.base_fields = OrderedDict([('pub_state', <django.forms.fields.TypedChoiceField object at 0x7fb59e11cb70>), ('status', <django.forms.fields.TypedChoiceField object at 0x7fb59e09f278>), ('title', <django.forms.fields.CharField object at 0x7fb59e09f0f0>), ('slug', <django.forms.fields.SlugField object at 0x7fb59e09f048>), ('body', <kawaz.core.forms.fields.MarkdownField object at 0x7fb59e0ab710>), ('icon', <django.forms.fields.ImageField object at 0x7fb59e09feb8>), ('category', <django.forms.models.ModelChoiceField object at 0x7fb59e0abd68>), ('tracker', <django.forms.fields.URLField object at 0x7fb59e0ab978>), ('repository', <django.forms.fields.URLField object at 0x7fb59e04ab70>)])
ProjectCreateForm.declared_fields = OrderedDict([('body', <kawaz.core.forms.fields.MarkdownField object at 0x7fb59e0ab710>)])
ProjectCreateForm.media
class kawaz.apps.projects.forms.ProjectUpdateForm(*args, **kwargs)[ソース]

ベースクラス: kawaz.apps.projects.forms.ProjectCreateForm

class Meta[ソース]

ベースクラス: kawaz.apps.projects.forms.Meta

exclude = ['slug']
ProjectUpdateForm.base_fields = OrderedDict([('pub_state', <django.forms.fields.TypedChoiceField object at 0x7fb59e0b9dd8>), ('status', <django.forms.fields.TypedChoiceField object at 0x7fb59e0b9ef0>), ('title', <django.forms.fields.CharField object at 0x7fb59e0b9f28>), ('body', <kawaz.core.forms.fields.MarkdownField object at 0x7fb59e0ab710>), ('icon', <django.forms.fields.ImageField object at 0x7fb59e045438>), ('category', <django.forms.models.ModelChoiceField object at 0x7fb59e0450b8>), ('tracker', <django.forms.fields.URLField object at 0x7fb59e0453c8>), ('repository', <django.forms.fields.URLField object at 0x7fb59e09fb70>)])
ProjectUpdateForm.declared_fields = OrderedDict([('body', <kawaz.core.forms.fields.MarkdownField object at 0x7fb59e0ab710>)])
ProjectUpdateForm.media
models Module
class kawaz.apps.projects.models.Category(*args, **kwargs)[ソース]

ベースクラス: django.db.models.base.Model

プロジェクトが所属するカテゴリモデル

スタッフが作成し、メンバーがプロジェクト作成・編集時に利用する

exception DoesNotExist

ベースクラス: django.core.exceptions.ObjectDoesNotExist

exception Category.MultipleObjectsReturned

ベースクラス: django.core.exceptions.MultipleObjectsReturned

Category.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Category.label

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Category.objects = <django.db.models.manager.Manager object>
Category.projects

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class kawaz.apps.projects.models.Project(*args, **kwargs)[ソース]

ベースクラス: django.db.models.base.Model

現在進行形で作成しているプロジェクトを示すモデル

メンバーであれば自由に作成可能で所有者および参加者が編集権限を持つ また削除権限は所有者のみが持ち、所有権限の委託は未だ作成されていない。

exception DoesNotExist

ベースクラス: django.core.exceptions.ObjectDoesNotExist

exception Project.MultipleObjectsReturned

ベースクラス: django.core.exceptions.MultipleObjectsReturned

Project.STATUS = (('planning', <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7fb59fd4b9e8>), ('active', <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7fb59fd4bba8>), ('paused', <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7fb59fd4bbe0>), ('eternal', <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7fb59fd4bc18>), ('done', <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7fb59fd4bc88>))
Project.active_members
Project.administrator

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Project.administrator_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Project.body

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Project.category

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Project.category_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Project.created_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Project.get_absolute_url()[ソース]
Project.get_default_icon(size)[ソース]

デフォルトアイコンを返します

Project.get_huge_icon()
Project.get_icon(size)[ソース]

渡したサイズのアイコンURLを返します 未設定の場合や、見つからない場合はデフォルトアイコンを返します

Project.get_large_icon()
Project.get_middle_icon()
Project.get_next_by_created_at(*moreargs, **morekwargs)
Project.get_next_by_updated_at(*moreargs, **morekwargs)
Project.get_previous_by_created_at(*moreargs, **morekwargs)
Project.get_previous_by_updated_at(*moreargs, **morekwargs)
Project.get_pub_state_display(*moreargs, **morekwargs)
Project.get_small_icon()
Project.get_status_display(*moreargs, **morekwargs)
Project.icon

Enhanced ImageFileDescriptor

Just like the ImageFileDescriptor, but for ThumbnailField. The only difference is removing previous Image and Thumbnails from storage when the value has changed.

Project.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Project.is_legacy

企画中か活動中、かつ180日以上更新されていない場合、Trueが返ります

Project.is_member(user)[ソース]

指定されたユーザーがこのプロジェクトに参加しているか否か

Project.join(user)[ソース]

指定されたユーザーを参加させる

ユーザーに参加権限がない場合は PermissionDenied を投げる

Project.last_modifier

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Project.last_modifier_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Project.members

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

pizza.toppings and topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Project.objects = <kawaz.apps.projects.models.ProjectManager object>
Project.product

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

place.restaurant is a ReverseOneToOneDescriptor instance.

Project.pub_state

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Project.quit(user)[ソース]

指定されたユーザーを退会させる

ユーザーに退会権限がない場合は PermissionDenied を投げる

Project.repository

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Project.slug

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Project.status

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Project.title

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Project.tracker

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Project.updated_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class kawaz.apps.projects.models.ProjectManager[ソース]

ベースクラス: django.db.models.manager.Manager, kawaz.core.publishments.models.PublishmentManagerMixin

active(user)[ソース]

指定されたユーザーが閲覧可能なプロジェクトのうち、活動中のもののみ を含むクエリを返す

archived(user)[ソース]

指定されたユーザーがー閲覧可能なプロジェクトのうち アーカイブ化されたプロジェクトのクエリを返す 以下のようなプロジェクトがアーカイブである

状態がpaused, eternaled, doneのいずれかである 状態がplanningかつ、created_atから90日以上経過している

author_field_name = 'administrator'
recently_planned(user)[ソース]

指定されたユーザーがー閲覧可能なプロジェクトのうち 最近企画されたプロジェクトのクエリを返す 状態がplanningかつ、created_atが90日未満である

kawaz.apps.projects.models.join_administrator(**kwargs)[ソース]

プロジェクト作成時に自動的に管理者をプロジェクトに参加させるシグナル処理

perms Module
class kawaz.apps.projects.perms.ProjectPermissionLogic[ソース]

ベースクラス: permission.logics.base.PermissionLogic

has_perm(user_obj, perm, obj=None)[ソース]

Check if user have a specified project permissions (of obj)

urls Module
views Module
class kawaz.apps.projects.views.ProjectArchiveView(**kwargs)[ソース]

ベースクラス: django.views.generic.list.ListView

アーカイブ化されたプロジェクト閲覧用のビューです

get_queryset()[ソース]
order_by = ('title', 'category', 'status', 'created_at')
paginate_by = 50
template_name_suffix = '_archive'
class kawaz.apps.projects.views.ProjectCreateView(**kwargs)[ソース]

ベースクラス: django.contrib.messages.views.SuccessMessageMixin, django.views.generic.edit.CreateView

dispatch(request, *args, **kwargs)
form_class

ProjectCreateForm のエイリアス

form_valid(form)[ソース]
get_success_message(cleaned_data)[ソース]
model

Project のエイリアス

class kawaz.apps.projects.views.ProjectDeleteView(**kwargs)[ソース]

ベースクラス: kawaz.core.views.delete.DeleteSuccessMessageMixin, django.views.generic.edit.DeleteView

dispatch(request, *args, **kwargs)
get_success_message()[ソース]
model

Project のエイリアス

success_url = <django.utils.functional.lazy.<locals>.__proxy__ object>
class kawaz.apps.projects.views.ProjectDetailView(**kwargs)[ソース]

ベースクラス: django.views.generic.detail.DetailView

dispatch(request, *args, **kwargs)
get_queryset()[ソース]
model

Project のエイリアス

class kawaz.apps.projects.views.ProjectJoinView(**kwargs)[ソース]

ベースクラス: django.views.generic.detail.SingleObjectMixin, django.views.generic.base.RedirectView

メンバーが参加する際に使用するView

dispatch(request, *args, **kwargs)
get_redirect_url(**kwargs)[ソース]
http_method_names = ['post']
model

Project のエイリアス

permanent = False
post(request, *args, **kwargs)[ソース]
class kawaz.apps.projects.views.ProjectListView(**kwargs)[ソース]

ベースクラス: django.views.generic.list.ListView

dispatch(request, *args, **kwargs)
get_queryset()[ソース]
model

Project のエイリアス

class kawaz.apps.projects.views.ProjectPreviewView(**kwargs)[ソース]

ベースクラス: kawaz.core.views.preview.SingleObjectPreviewViewMixin, django.views.generic.detail.DetailView

model

Project のエイリアス

template_name = 'projects/components/project_detail.html'
class kawaz.apps.projects.views.ProjectQuitView(**kwargs)[ソース]

ベースクラス: django.views.generic.detail.SingleObjectMixin, django.views.generic.base.RedirectView

メンバーが退会する際に使用するView

dispatch(request, *args, **kwargs)
get_redirect_url(**kwargs)[ソース]
http_method_names = ['post']
model

Project のエイリアス

permanent = False
post(request, *args, **kwargs)[ソース]
class kawaz.apps.projects.views.ProjectUpdateView(**kwargs)[ソース]

ベースクラス: django.contrib.messages.views.SuccessMessageMixin, django.views.generic.edit.UpdateView

dispatch(request, *args, **kwargs)
form_class

ProjectUpdateForm のエイリアス

form_valid(form)[ソース]
get_success_message(cleaned_data)[ソース]
model

Project のエイリアス

Subpackages
migrations Package
0001_initial Module
class kawaz.apps.projects.migrations.0001_initial.Migration(name, app_label)[ソース]

ベースクラス: django.db.migrations.migration.Migration

dependencies = [('personas', '__first__')]
operations = [<CreateModel options={'ordering': ('label',), 'verbose_name': 'Category', 'verbose_name_plural': 'Categories'}, fields=[('id', <django.db.models.fields.AutoField>), ('label', <django.db.models.fields.CharField>)], bases=(<class 'django.db.models.base.Model'>,), name='Category'>, <CreateModel options={'ordering': ('status', '-updated_at', 'title'), 'permissions': (('join_project', 'Can join to the project'), ('quit_project', 'Can quit from the project'), ('view_project', 'Can view the project')), 'verbose_name': 'Project', 'verbose_name_plural': 'Projects'}, fields=[('id', <django.db.models.fields.AutoField>), ('pub_state', <django.db.models.fields.CharField>), ('status', <django.db.models.fields.CharField>), ('title', <django.db.models.fields.CharField>), ('slug', <django.db.models.fields.SlugField>), ('body', <django.db.models.fields.TextField>), ('icon', <thumbnailfield.fields.ThumbnailField>), ('created_at', <django.db.models.fields.DateTimeField>), ('updated_at', <django.db.models.fields.DateTimeField>), ('tracker', <django.db.models.fields.URLField>), ('repository', <django.db.models.fields.URLField>), ('administrator', <django.db.models.fields.related.ForeignKey>), ('category', <django.db.models.fields.related.ForeignKey>), ('last_modifier', <django.db.models.fields.related.ForeignKey>), ('members', <django.db.models.fields.related.ManyToManyField>)], bases=(<class 'django.db.models.base.Model'>,), name='Project'>]
templatetags Package
projects_tags Module
kawaz.apps.projects.templatetags.projects_tags.get_projects(context, lookup='published')[ソース]

任意の<lookup>によりフィルタされた Project のクエリを取得し指定された <variable>に格納するテンプレートタグ

Syntax:
{% get_projects as <variable> %} {% get_projects <lookup> as <variable> %}
Lookup: (Default: published)

published: ユーザーに対して公開された Project を返す draft: ユーザーが編集可能な下書き Project を返す active: ユーザーが閲覧可能なactiveな Project を返す recently_planned: ユーザーが閲覧可能な直近90日以内に作られた企画中な Project を返す archived: 以下の条件を満たすプロジェクトを返す

状態が一時停止中、エターナった、完成済み、もしくは 企画中であるが、作成から90日以上経過している

Examples

公開された Project のクエリを取得し、最新5件のみを描画

{% get_projects as projects %} {% for project in projects|slice:”:5” %}

{{ project }}

{% endfor %}

下書き記事を取得

{% get_projects ‘draft’ as draft_projects %}

kawaz.apps.projects.templatetags.projects_tags.get_published_joined_projects_of(context, user)[ソース]

userがメンバーに含まれているプロジェクト一覧を返します

Syntax:
{% get_published_joined_projects_of user %}
tests Package
tests Package
factories Module
test_activity Module
test_models Module
test_perms Module
test_templatetags Module
test_views Module
stars Package
admin Module
class kawaz.apps.stars.admin.StarAdmin(model, admin_site)[ソース]

ベースクラス: django.contrib.admin.options.ModelAdmin

media
models Module
class kawaz.apps.stars.models.Star(*args, **kwargs)[ソース]

ベースクラス: django.db.models.base.Model

はてなスター的なモデル。主にJavaScriptで処理を行う

exception DoesNotExist

ベースクラス: django.core.exceptions.ObjectDoesNotExist

exception Star.MultipleObjectsReturned

ベースクラス: django.core.exceptions.MultipleObjectsReturned

Star.author

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Star.author_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Star.content_object

Provide a generic many-to-one relation through the content_type and object_id fields.

This class also doubles as an accessor to the related object (similar to ForwardManyToOneDescriptor) by adding itself as a model attribute.

Star.content_type

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Star.content_type_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Star.created_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Star.get_next_by_created_at(*moreargs, **morekwargs)
Star.get_previous_by_created_at(*moreargs, **morekwargs)
Star.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Star.object_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Star.objects = <kawaz.apps.stars.models.StarManager object>
Star.quote

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Star.save(force_insert=False, force_update=False, using=None, update_fields=None)

Saves the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

Star.tooltip_text

ツールチップに表示させる内容を取り出します

Example

井の中かわず 井の中かわず「ゲーム作りました」

class kawaz.apps.stars.models.StarManager[ソース]

ベースクラス: django.db.models.manager.Manager

add_to_object(obj, author, quote='')[ソース]

指定されたオブジェクトに新たにスターを作成

パラメタ:
  • obj (model instance) – 付加対象のモデルインスタンス
  • author (user instance) – スター付加を行うユーザー
  • quote (str) – 引用文字列(デフォルト: ‘’
Notice:

`author`を指定するが、実際に`author`がstarを対象オブジェクトに 付加可能かどうかのテストは行わない。 このテストを行う場合は下記のように権限テストを行う必要がある

>>> author.has_perm('stars.add_star', obj=obj)
cleanup_object(obj)[ソース]

指定されたオブジェクトに付加されている全てのスターを削除

パラメタ:obj (model instance) – 削除対象のモデルインスタンス
get_for_object(obj)[ソース]
get_queryset()[ソース]
published(user_obj)[ソース]
remove_from_object(obj, star)[ソース]

指定されたオブジェクトから指定されたスターを削除

パラメタ:
  • obj (model instance) – 削除対象のモデルインスタンス
  • star (star instance) – 削除対象のスターインスタンス
Raises:

ObjectDoesNotExist – 指定されたスターがオブジェクトに関連付けられて 居ない場合に発生

class kawaz.apps.stars.models.StarQuerySet(model=None, query=None, using=None, hints=None)[ソース]

ベースクラス: django.db.models.query.QuerySet

get_for_object(obj)[ソース]

指定されたオブジェクトに関係するスターを含むクエリを返す

パラメタ:obj (model instance) – 検索対象のモデルインスタンス
published(user_obj)[ソース]

指定されたユーザーが閲覧可能なスターを含むクエリを返す

パラメタ:user_obj (user instance) – 対象ユーザーインスタンス
戻り値:queryset
perms Module
class kawaz.apps.stars.perms.StarPermissionLogic[ソース]

ベースクラス: permission.logics.base.PermissionLogic

has_perm(user_obj, perm, obj=None)[ソース]

Starのパーミッションを処理する

Model permission:
add: メンバーであれば True change: 誰も持たない delete: メンバーであれば True view: 全員 True
Object permission:
add: メンバーかつ指定されたオブジェクトの閲覧権限があれば True
詳細は後記

change: 誰も持たない delete: メンバーかつ指定されたスターがリンクしている

オブジェクトの閲覧権限があれば True もしくは指定されたスターがリンクしているオブジェクトの 編集権限があれば True
view: 指定されたスターがリンクしているオブジェクトの閲覧権限
があれば True
Notice:
通常 add 権限は Model permission のみが存在するが、Star の場合は `has_perm`に付加対象オブジェクトを渡すことで付加対象オブジェクト に対する付加権限を調べることが可能
views Module
Subpackages
api Package
api Package
serializers Module
class kawaz.apps.stars.api.serializers.StarSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[ソース]

ベースクラス: rest_framework.serializers.ModelSerializer

class Meta[ソース]

ベースクラス: object

fields = ('id', 'content_type', 'object_id', 'author', 'quote', 'html', 'tooltip')
model

Star のエイリアス

StarSerializer.create(validated_data)[ソース]
StarSerializer.get_html(obj)[ソース]
views Module
class kawaz.apps.stars.api.views.StarViewSet(**kwargs)[ソース]

ベースクラス: kawaz.api.mixins.CreateModelMixin, rest_framework.mixins.DestroyModelMixin, rest_framework.mixins.ListModelMixin, kawaz.api.views.KawazGenericViewSet

author_field_name = 'author'
filter_fields = ('content_type', 'object_id')
model

Star のエイリアス

queryset
serializer_class

StarSerializer のエイリアス

suffix = None
migrations Package
0001_initial Module
class kawaz.apps.stars.migrations.0001_initial.Migration(name, app_label)[ソース]

ベースクラス: django.db.migrations.migration.Migration

dependencies = [('personas', '__first__'), ('contenttypes', '0001_initial')]
operations = [<CreateModel options={'ordering': ('created_at',), 'permissions': (('view_star', 'Can view the Star'),), 'verbose_name': 'Star', 'verbose_name_plural': 'Stars'}, fields=[('id', <django.db.models.fields.AutoField>), ('object_id', <django.db.models.fields.PositiveIntegerField>), ('quote', <django.db.models.fields.CharField>), ('created_at', <django.db.models.fields.DateTimeField>), ('author', <django.db.models.fields.related.ForeignKey>), ('content_type', <django.db.models.fields.related.ForeignKey>)], bases=(<class 'django.db.models.base.Model'>,), name='Star'>]
0002_test Module
class kawaz.apps.stars.migrations.0002_test.Migration(name, app_label)[ソース]

ベースクラス: django.db.migrations.migration.Migration

dependencies = [('personas', '__first__'), ('stars', '0001_initial')]
operations = []
templatetags Package
stars_tags Module
kawaz.apps.stars.templatetags.stars_tags.get_star_endpoint(context, object)[ソース]

任意の<object>に対するStarのエンドポイントURLを取得し、指定された <variable>に格納するテンプレートタグ

Syntax:
{% get_star_endpoint <object> as <variable> %}

Examples

あるオブジェクトに対するendpointを取得し、フォームを生成する

{% get_star_endpoint object as endpoint %} <form action=”{{ endpoint }}” method=”POST”>

<input type=”submit”>

</form>

kawaz.apps.stars.templatetags.stars_tags.get_stars(object)[ソース]

任意の<object>についた Star のクエリを取得し指定された <variable>に格納するテンプレートタグ

Syntax:
{% get_stars <object> as <variable> %}

Examples

公開された Star のクエリを取得し、最新5件のみを描画

{% get_stars object as stars %} {% for star in stars|slice:”:5” %}

{{ star }}

{% endfor %}

tests Package
factories Module
models Module
class kawaz.apps.stars.tests.models.StarTestArticle(id, pub_state, author, title)[ソース]

ベースクラス: django.db.models.base.Model

exception DoesNotExist

ベースクラス: django.core.exceptions.ObjectDoesNotExist

exception StarTestArticle.MultipleObjectsReturned

ベースクラス: django.core.exceptions.MultipleObjectsReturned

StarTestArticle.author

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

StarTestArticle.author_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

StarTestArticle.get_pub_state_display(*moreargs, **morekwargs)
StarTestArticle.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

StarTestArticle.objects = <django.db.models.manager.Manager object>
StarTestArticle.pub_state

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

StarTestArticle.title

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

test_api Module
test_models Module
test_perms Module
test_templatetags Module

core Package

Subpackages
activities Package
urls Module
views Module
class kawaz.core.activities.views.ActivityListView(**kwargs)[ソース]

ベースクラス: django.views.generic.list.ListView

get_queryset()[ソース]
model

Activity のエイリアス

paginate_by = 10
Subpackages
hatenablog Package
hatenablog Package
activity Module
class kawaz.core.activities.hatenablog.activity.HatenablogEntryActivityMediator[ソース]

ベースクラス: activities.mediator.ActivityMediator

alter(instance, activity, **kwargs)[ソース]
notifiers = ('twitter_kawaz_info', 'twitter_kawaz_official')
admin Module
class kawaz.core.activities.hatenablog.admin.HatenablogEntryAdmin(model, admin_site)[ソース]

ベースクラス: django.contrib.admin.options.ModelAdmin

media
conf Module
class kawaz.core.activities.hatenablog.conf.ActivitiesHatenablogAppConf(**kwargs)[ソース]

ベースクラス: appconf.base.AppConf

FEED_URL = 'http://kawazinfo.hateblo.jp/rss'
class Meta[ソース]

ベースクラス: object

prefix = 'activities_hatenablog'
models Module
class kawaz.core.activities.hatenablog.models.HatenablogEntry(*args, **kwargs)[ソース]

ベースクラス: django.db.models.base.Model

はてなブログで運営されているKawaz広報ブログの各エントリーを表すモデル

exception DoesNotExist

ベースクラス: django.core.exceptions.ObjectDoesNotExist

exception HatenablogEntry.MultipleObjectsReturned

ベースクラス: django.core.exceptions.MultipleObjectsReturned

HatenablogEntry.created_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

HatenablogEntry.get_absolute_url()[ソース]
HatenablogEntry.get_next_by_created_at(*moreargs, **morekwargs)
HatenablogEntry.get_previous_by_created_at(*moreargs, **morekwargs)
HatenablogEntry.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

HatenablogEntry.md5

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

HatenablogEntry.objects = <django.db.models.manager.Manager object>
HatenablogEntry.thumbnail

Just like the FileDescriptor, but for ImageFields. The only difference is assigning the width/height to the width_field/height_field, if appropriate.

HatenablogEntry.title

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

HatenablogEntry.url

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

scraper Module
class kawaz.core.activities.hatenablog.scraper.HatenablogFeedScraper(url=None, verbose=False)[ソース]

ベースクラス: object

fetch()[ソース]
Subpackages
management Package
Subpackages
commands Package
fetch_hatenablog_entries Module
class kawaz.core.activities.hatenablog.management.commands.fetch_hatenablog_entries.Command(stdout=None, stderr=None, no_color=False)[ソース]

ベースクラス: django.core.management.base.BaseCommand

add_arguments(parser)[ソース]
handle(*args, **options)[ソース]
help = 'Command to fetch entries in Hatenablog. It will ignore duplicated entries.'
migrations Package
0001_initial Module
class kawaz.core.activities.hatenablog.migrations.0001_initial.Migration(name, app_label)[ソース]

ベースクラス: django.db.migrations.migration.Migration

dependencies = []
operations = [<CreateModel options={'ordering': ('-created_at',), 'verbose_name': 'Hatenablog entry', 'verbose_name_plural': 'Hatenablog entries'}, fields=[('id', <django.db.models.fields.AutoField>), ('title', <django.db.models.fields.CharField>), ('url', <django.db.models.fields.URLField>), ('thumbnail', <django.db.models.fields.files.ImageField>), ('md5', <django.db.models.fields.CharField>), ('created_at', <django.db.models.fields.DateTimeField>)], bases=(<class 'django.db.models.base.Model'>,), name='HatenablogEntry'>]
templatetags Package
activities_hatenablog_tag Module
kawaz.core.activities.hatenablog.templatetags.activities_hatenablog_tag.get_hatenablog_entries()[ソース]

Hatenablog 更新情報を指定された <variable> に格納

Syntax:
{% get_hatenablog_entries as <variable> %}

Example

最近更新された Hatenablog の記事を5つ描画

{% get_hatenablog_entries as entries %} {% for entry in entries|slice:”:5” %}

{{ entry }}

{% endfor %}

tests Package
factories Module
test_activity Module
test_models Module
test_scraper Module
class kawaz.core.activities.hatenablog.tests.test_scraper.HatenablogFeedScraperTestCase(methodName='runTest')[ソース]

ベースクラス: django.test.testcases.TestCase

setUp()[ソース]
test_scraper_can_fetch_entries()[ソース]
test_scraper_does_not_fetch_duplicate()[ソース]
kawaz.core.activities.hatenablog.tests.test_scraper.get(url, **kwargs)[ソース]
test_templatetags Module
tests Package
tests Package
factories Module
test_views Module
testcases Module
comments Package
comments Package
kawaz.core.comments.get_form()[ソース]
kawaz.core.comments.get_model()[ソース]
activity Module
class kawaz.core.comments.activity.CommentActivityMediator[ソース]

ベースクラス: activities.mediator.ActivityMediator

alter(instance, activity, **kwargs)[ソース]
translate_snapshot(snapshot)[ソース]
forms Module
class kawaz.core.comments.forms.KawazCommentForm(*args, **kwargs)[ソース]

ベースクラス: django_comments.forms.CommentForm

base_fields = OrderedDict([('content_type', <django.forms.fields.CharField object at 0x7fb59c9f9320>), ('object_pk', <django.forms.fields.CharField object at 0x7fb59c9f9278>), ('timestamp', <django.forms.fields.IntegerField object at 0x7fb59c9f9208>), ('security_hash', <django.forms.fields.CharField object at 0x7fb59c9f9198>), ('name', <django.forms.fields.CharField object at 0x7fb59c9f97f0>), ('email', <django.forms.fields.EmailField object at 0x7fb59c9f9b00>), ('url', <django.forms.fields.URLField object at 0x7fb59c9f69b0>), ('comment', <kawaz.core.forms.fields.MarkdownField object at 0x7fb59c9f96d8>), ('honeypot', <django.forms.fields.CharField object at 0x7fb59c9f6fd0>)])
declared_fields = OrderedDict([('content_type', <django.forms.fields.CharField object at 0x7fb59c9f9320>), ('object_pk', <django.forms.fields.CharField object at 0x7fb59c9f9278>), ('timestamp', <django.forms.fields.IntegerField object at 0x7fb59c9f9208>), ('security_hash', <django.forms.fields.CharField object at 0x7fb59c9f9198>), ('name', <django.forms.fields.CharField object at 0x7fb59c9f97f0>), ('email', <django.forms.fields.EmailField object at 0x7fb59c9f9b00>), ('url', <django.forms.fields.URLField object at 0x7fb59c9f69b0>), ('comment', <kawaz.core.forms.fields.MarkdownField object at 0x7fb59c9f96d8>), ('honeypot', <django.forms.fields.CharField object at 0x7fb59c9f6fd0>)])
media
models Module
perms Module
class kawaz.core.comments.perms.CommentPermissionLogic[ソース]

ベースクラス: permission.logics.base.PermissionLogic

has_perm(user_obj, perm, obj=None)[ソース]

コメントのパーミッションを処理する

Model permission:
add: メンバーであれば True change: 誰も持たない delete: 誰も持たない can_moderate: メンバーであればTrue
Object permission:

change: 誰も持たない delete: 誰も持たない can_moderate: 以下のいずれかの条件を満たす

  • ネルフ権限以上がある
  • コメントの作者が自分である
  • 指定されたコメントがリンクしているオブジェクトの編集権限を持っている
Notice:
django_comments.can_moderateはdjango_comments.Commentが持つパーミッションであり commentのis_removedフラグを変更する権限である
Subpackages
tests Package
tests Package
factories Module
models Module
class kawaz.core.comments.tests.models.CommentTestArticle(id, text, author)[ソース]

ベースクラス: django.db.models.base.Model

exception DoesNotExist

ベースクラス: django.core.exceptions.ObjectDoesNotExist

exception CommentTestArticle.MultipleObjectsReturned

ベースクラス: django.core.exceptions.MultipleObjectsReturned

CommentTestArticle.author

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

CommentTestArticle.author_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

CommentTestArticle.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

CommentTestArticle.objects = <django.db.models.manager.Manager object>
CommentTestArticle.text

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

test_activity Module
test_perms Module
test_views Module
db Package
decorators Module
kawaz.core.db.decorators.validate_on_save(klass)[ソース]

モデル保存時にバリデーションを走らせるためのクラスデコレータ

このデコレータが指定されたモデルを保存した場合、自動的に full_clean() が呼び出されバリデーションが走る

Usage:
>>> from django.db import models
>>> from django.core.exceptions import ValidationError
>>> @validation_on_save
>>> class Entry(models.Model):
...     def clean(self):
...         raise ValidationError
models Module
Subpackages
tests Package
models Module
class kawaz.core.db.tests.models.EvenNumberContainer(*args, **kwargs)[ソース]

ベースクラス: django.db.models.base.Model

A test model which does not allow to store odd number

exception DoesNotExist

ベースクラス: django.core.exceptions.ObjectDoesNotExist

exception EvenNumberContainer.MultipleObjectsReturned

ベースクラス: django.core.exceptions.MultipleObjectsReturned

EvenNumberContainer.clean()[ソース]
EvenNumberContainer.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

EvenNumberContainer.number

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

EvenNumberContainer.objects = <django.db.models.manager.Manager object>
test_decorators Module
class kawaz.core.db.tests.test_decorators.ValidationOnSaveDecoratorTestCase(methodName='runTest')[ソース]

ベースクラス: django.test.testcases.TestCase

test_non_validate_on_save()[ソース]

full_clean method should not be called without validate_on_save decorator

test_validate_on_save()[ソース]

full_clean method should be called with validate_on_save decorator

test_validate_on_save_disabled()[ソース]

full_clean method should not be called with VALIDATE_ON_SAVE_DISABLE

files Package
files Package
storages Module
class kawaz.core.files.storages.OverwriteStorage(location=None, base_url=None, file_permissions_mode=None, directory_permissions_mode=None)[ソース]

ベースクラス: django.core.files.storage.FileSystemStorage

get_available_name(name, max_length=None)[ソース]
filters Package
filters Package
widgets Module
class kawaz.core.filters.widgets.ListGroupLinkWidget(attrs=None, choices=())[ソース]

ベースクラス: django_filters.widgets.LinkWidget

Django FilterのfieldsをBootstrapのList Groupを使って出力するWidget

<div class=”list-group”>
<a href=”list-group-item” class=”“>All</a> <a href=”list-group-item active” class=”“>Item1</a> <a href=”list-group-item” class=”“>Item2</a>

</div>

media
option_string()[ソース]
render(name, value, attrs=None, choices=())[ソース]
render_option(name, selected_choices, option_value, option_label)[ソース]
forms Package
forms Package
fields Module
class kawaz.core.forms.fields.MarkdownField(*args, **kwargs)[ソース]

ベースクラス: django.forms.fields.CharField

helpers Module
class kawaz.core.forms.helpers.Bootstrap3HorizontalFormHelper(*args, **kwargs)[ソース]

ベースクラス: crispy_forms.helper.FormHelper

Bootstrap3のHorizontalFormを利用するためのHelperです

Ref:
http://django-crispy-forms.readthedocs.org/en/latest/crispy_tag_forms.html#bootstrap3-horizontal-forms
class kawaz.core.forms.helpers.Bootstrap3InlineFormHelper(*args, **kwargs)[ソース]

ベースクラス: crispy_forms.helper.FormHelper

Bootstrap3のInlineFormを利用するためのHelperです

Ref:
http://django-crispy-forms.readthedocs.org/en/latest/crispy_tag_forms.html#bootstrap3-inline-forms
class kawaz.core.forms.helpers.HorizontalBareFormHelper(*args, **kwargs)[ソース]

ベースクラス: kawaz.core.forms.helpers.Bootstrap3HorizontalFormHelper

HorizontalFormHelperの<form>タグでwrapされていない版です 主にget_form_helperテンプレートタグからの利用を想定しています form_tag = False

form_tag = False
class kawaz.core.forms.helpers.InlineBareFormHelper(*args, **kwargs)[ソース]

ベースクラス: kawaz.core.forms.helpers.Bootstrap3InlineFormHelper

InlineFormHelperの<form>タグでwrapされていない版です 主にget_form_helperテンプレートタグからの利用を想定しています form_tag = False

form_tag = False
mixins Module
class kawaz.core.forms.mixins.Bootstrap3HorizontalFormHelperMixin(*args, **kwargs)[ソース]

ベースクラス: kawaz.core.forms.mixins.FormHelperMixinBase

django-crispy-formsを使って、bootstrap3対応のHorizontalFormを作成するMixinです。

Usage:

class ArticleForm(BootstrapHorizontalFormMixin, ModelForm):
model = Article
helper_class

Bootstrap3HorizontalFormHelper のエイリアス

class kawaz.core.forms.mixins.Bootstrap3InlineFormHelperMixin(*args, **kwargs)[ソース]

ベースクラス: kawaz.core.forms.mixins.FormHelperMixinBase

django-crispy-formsを使って、bootstrap3対応のInlineFormを作成するMixinです。

helper_class

Bootstrap3InlineFormHelper のエイリアス

class kawaz.core.forms.mixins.FormHelperMixinBase(*args, **kwargs)[ソース]

ベースクラス: object

form_tag = True
get_additional_objects()[ソース]
get_helper()[ソース]
helper_class = None
widgets Module
class kawaz.core.forms.widgets.MaceEditorWidget[ソース]

ベースクラス: django.forms.widgets.Textarea

Markdownエディタを組み込むためのWidgetです

class Media[ソース]

ベースクラス: object

js = ('vendor/mace.min.js', 'js/editor.js')
MaceEditorWidget.media
MaceEditorWidget.render(name, value, attrs=None)[ソース]
class kawaz.core.forms.widgets.RadioSelectWithHelpText(*args, **kwargs)[ソース]

ベースクラス: django.forms.widgets.RadioSelect

RadioSelect with help texts

get_renderer(name, value, attrs=None, choices=())[ソース]
media
renderer

RadioWithHelpTextFieldRenderer のエイリアス

class kawaz.core.forms.widgets.RadioWithHelpTextFieldRenderer(name, value, attrs, choices, help_texts)[ソース]

ベースクラス: django.forms.widgets.RadioFieldRenderer

render()[ソース]
Subpackages
templatetags Package
templatetags Package
form_helper Module
kawaz.core.forms.templatetags.form_helper.get_form_helper(type='horizontal')[ソース]

<type>に応じたFormHelperを返します。 もし、該当する<type>が見つからない場合は、TemplateSyntaxErrorを投げます。

Syntax:
{% get_form_helper as <variable> %} {% get_form_helper <type> as <variable> %}
Type: (Default: horizontal)
horizontal: Bootstrap3のHorizontal Formを描画するHelper inline: Bootstrap3Inline Formを描画するHelper bare: horizontalを描画し、formタグに囲まれていないHelper

Examples

任意のFormに対してHorizontalFormHelperを適応する {% load crispy_form_tags %} {% load form_helper %}

{% get_form_helper “horizontal” as helper %} {% crispy form helper %}

tests Package
tests Package
test_templatetags Module
class kawaz.core.forms.tests.test_templatetags.GetFormHelperTemplateTagTestCase(methodName='runTest')[ソース]

ベースクラス: django.test.testcases.TestCase

test_get_helper_horizontal()[ソース]

get_helper horizontalでBootstrap3HorizontalFormHelperを取り出せる

test_get_helper_horizontal_bare()[ソース]

get_helper bareでHorizontalBareFormHelperを取り出せる

test_get_helper_inline_bare()[ソース]

get_helper inline_bareでInlineBareFormHelperを取り出せる

test_get_helper_unknown()[ソース]

get_helperに存在しないtypeを渡したとき、TemplateSyntaxErrorが返る

management Package
management Package

Kawaz 用 manage.py 拡張モジュール

Subpackages
management Package
Subpackages
commands Package
init_database Module

Kawaz開発用にデータベースの初期化等を行うコマンド

class kawaz.core.management.management.commands.init_database.Command(stdout=None, stderr=None, no_color=False)[ソース]

ベースクラス: django.core.management.base.BaseCommand

add_arguments(parser)[ソース]
handle(*args, **options)[ソース]
help = 'Command to initialize database. It will overwrite the existing data in database thus Run this command WITH CLOSE ATTENTION.'
start_livereload Module
class kawaz.core.management.management.commands.start_livereload.Command(stdout=None, stderr=None, no_color=False)[ソース]

ベースクラス: django.core.management.base.BaseCommand

handle(*args, **options)[ソース]
personas Package
personas Package

承認システム用カスタムユーザApp

filters Module
class kawaz.core.personas.filters.PersonaFilter(data=None, queryset=None, prefix=None, strict=None, request=None)[ソース]

ベースクラス: django_filters.filterset.FilterSet

class Meta[ソース]

ベースクラス: object

exclude = ('avatar',)
model

Persona のエイリアス

PersonaFilter.base_filters = OrderedDict([('password', <django_filters.filters.CharFilter object at 0x7fb59bceb898>), ('last_login', <django_filters.filters.DateTimeFilter object at 0x7fb59bceb780>), ('groups', <django_filters.filters.ModelMultipleChoiceFilter object at 0x7fb59bceb8d0>), ('user_permissions', <django_filters.filters.ModelMultipleChoiceFilter object at 0x7fb59bceb978>), ('username', <django_filters.filters.CharFilter object at 0x7fb59bcebe10>), ('first_name', <django_filters.filters.CharFilter object at 0x7fb59bcebe48>), ('last_name', <django_filters.filters.CharFilter object at 0x7fb59bcebda0>), ('email', <django_filters.filters.CharFilter object at 0x7fb59bceb828>), ('is_active', <django_filters.filters.BooleanFilter object at 0x7fb59bceb908>), ('date_joined', <django_filters.filters.DateTimeFilter object at 0x7fb59bceb4a8>), ('nickname', <django_filters.filters.CharFilter object at 0x7fb59bcebc88>), ('quotes', <django_filters.filters.CharFilter object at 0x7fb59bcebc50>), ('gender', <django_filters.filters.ChoiceFilter object at 0x7fb59bceb860>), ('role', <django_filters.filters.ChoiceFilter object at 0x7fb59bceb9b0>), ('skills', <django_filters.filters.ModelChoiceFilter object at 0x7fb59bc36fd0>)])
PersonaFilter.declared_filters = OrderedDict([('skills', <django_filters.filters.ModelChoiceFilter object at 0x7fb59bc36fd0>)])
perms Module
class kawaz.core.personas.perms.AdamPermissionLogic(any_permission=False, add_permission=False, change_permission=False, delete_permission=False)[ソース]

ベースクラス: kawaz.core.personas.perms.BaseRolePermissionLogic

Permission logic class to allow permissions to over `Adam`(superuser) role user

role_names = ['adam']
class kawaz.core.personas.perms.BaseRolePermissionLogic(any_permission=False, add_permission=False, change_permission=False, delete_permission=False)[ソース]

ベースクラス: permission.logics.base.PermissionLogic

Permission logic class for role based permission system It is checked by user_obj.role

has_perm(user_obj, perm, obj=None)[ソース]

Check if user have permission (of object) It is determined from the user_obj.role.

If no object is specified, if any_permission is True it returns True. if else returns False.

If an object is specified, it will return True if the user’s role is contained in role_names.

パラメタ:
  • user_obj (django user model instance) – A django user model instance which be checked
  • perm (string) – app_label.codename formatted permission string
  • obj (None or django model instance) – None or django model instance for object permission
戻り値:

Wheter the specified user have specified permission (of specified object).

戻り値の型:

boolean

role_names = []
class kawaz.core.personas.perms.ChildrenPermissionLogic(any_permission=False, add_permission=False, change_permission=False, delete_permission=False)[ソース]

ベースクラス: kawaz.core.personas.perms.BaseRolePermissionLogic

Permission logic class to allow permissions to over Children role user.

role_names = ['adam', 'seele', 'nerv', 'children']
class kawaz.core.personas.perms.KawazAuthorPermissionLogic(field_name=None, any_permission=None, change_permission=None, delete_permission=None)[ソース]

ベースクラス: permission.logics.author.AuthorPermissionLogic

Kawaz用AuthorPermissionLogic

Kawazの仕様では、willeがauthorになることは現段階ではない。 通常のAuthorPermissionLogicを利用すると、willeであっても ログインユーザーであればモデルパーミッションがTrueになり 使い勝手が悪い そのため、wille以下の場合はFalseが返るようにした

has_perm(user_obj, perm, obj=None)[ソース]
role_names = ['adam', 'seele', 'nerv', 'children']
class kawaz.core.personas.perms.NervPermissionLogic(any_permission=False, add_permission=False, change_permission=False, delete_permission=False)[ソース]

ベースクラス: kawaz.core.personas.perms.BaseRolePermissionLogic

Permission logic class to allow permissions to over `Nerv`(staff) role user

role_names = ['adam', 'seele', 'nerv']
class kawaz.core.personas.perms.PersonaPermissionLogic[ソース]

ベースクラス: permission.logics.base.PermissionLogic

Permission logics which check the user’s role and return corresponding permission

has_perm(user_obj, perm, obj=None)[ソース]
class kawaz.core.personas.perms.SeelePermissionLogic(any_permission=False, add_permission=False, change_permission=False, delete_permission=False)[ソース]

ベースクラス: kawaz.core.personas.perms.BaseRolePermissionLogic

Permission logic class to allow permissions to over Seele role user.

role_names = ['adam', 'seele']
urls Module
Subpackages
activities Package
activities Package
persona Module
class kawaz.core.personas.activities.persona.PersonaActivityMediator[ソース]

ベースクラス: kawaz.core.personas.activities.persona.PersonaActivityMediatorBase

注釈

Personaは3つのMediatorからさまざまなイベントが発行される activated: Profileの作成(ユーザーのアクティベート時にプロフィールが

作成されるため、プロフィールが生成されたときをアクティベート されたと判定している)

profile_updated: プロフィールの更新 comment_added: コメントの追加 account_added: アカウントの追加

updatedイベントは初回更新時の前回との差分がないとき、`last_login`カラム が更新されるだけでも通知されてしまう問題があり対処が面倒なので、ユーザ の更新は一切通知されない仕様にする

alter(instance, activity, **kwargs)[ソース]
prepare_context(activity, context, typename=None)[ソース]
class kawaz.core.personas.activities.persona.PersonaActivityMediatorBase[ソース]

ベースクラス: activities.mediator.ActivityMediator

serialize_snapshot(snapshot)[ソース]
profile Module
class kawaz.core.personas.activities.profile.AccountActivityMediator[ソース]

ベースクラス: kawaz.core.personas.activities.persona.PersonaActivityMediatorBase

alter(instance, activity, **kwargs)[ソース]
class kawaz.core.personas.activities.profile.ProfileActivityMediator[ソース]

ベースクラス: kawaz.core.personas.activities.persona.PersonaActivityMediatorBase

alter(instance, activity, **kwargs)[ソース]
admin Package
admin Package
persona Module
class kawaz.core.personas.admin.persona.PersonaAdmin(model, admin_site)[ソース]

ベースクラス: django.contrib.auth.admin.UserAdmin

add_fieldsets = ((None, {'classes': ('wide',), 'fields': ('username', 'password1', 'password2')}),)
add_form

PersonaCreationForm のエイリアス

fieldsets = ((None, {'fields': ('username', 'email', 'password')}), (<django.utils.functional.lazy.<locals>.__proxy__ object at 0x7fb59fc8acc0>, {'fields': ('nickname', 'gender', 'avatar')}), (<django.utils.functional.lazy.<locals>.__proxy__ object at 0x7fb59fc8acf8>, {'fields': ('quotes', 'first_name', 'last_name')}), (<django.utils.functional.lazy.<locals>.__proxy__ object at 0x7fb59fc8ad30>, {'fields': ('is_active', 'role', 'groups', 'user_permissions')}), (<django.utils.functional.lazy.<locals>.__proxy__ object at 0x7fb59fc8ad68>, {'fields': ('last_login', 'date_joined')}))
form

PersonaAdminUpdateForm のエイリアス

get_readonly_fields(request, obj=None)[ソース]
list_display = ('nickname', 'username', 'email', 'date_joined', 'last_login')
list_filter = ('role', 'is_active', 'groups')
media
ordering = ('nickname', 'username', 'email')
search_fields = ('nickname', 'username', 'email', 'first_name', 'last_name', 'role')
profile Module
class kawaz.core.personas.admin.profile.AccountAdmin(model, admin_site)[ソース]

ベースクラス: django.contrib.admin.options.ModelAdmin

media
class kawaz.core.personas.admin.profile.ProfileAdmin(model, admin_site)[ソース]

ベースクラス: django.contrib.admin.options.ModelAdmin

list_display = ('nickname', 'birthday', 'place')
media
nickname(obj)[ソース]
search_fields = ('address', 'remarks')
class kawaz.core.personas.admin.profile.ServiceAdmin(model, admin_site)[ソース]

ベースクラス: django.contrib.admin.options.ModelAdmin

media
class kawaz.core.personas.admin.profile.SkillAdmin(model, admin_site)[ソース]

ベースクラス: django.contrib.admin.options.ModelAdmin

media
api Package
api Package
serializers Module
class kawaz.core.personas.api.serializers.PersonaSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[ソース]

ベースクラス: rest_framework.serializers.ModelSerializer

class Meta[ソース]

ベースクラス: object

fields = ('id', 'nickname', 'quotes', 'small_avatar', 'middle_avatar', 'large_avatar', 'huge_avatar', 'gender', 'role')
model

Persona のエイリアス

forms Package
forms Package
persona Module
class kawaz.core.personas.forms.persona.PersonaAdminUpdateForm(*args, **kwargs)[ソース]

ベースクラス: django.contrib.auth.forms.UserChangeForm

A form for updating users. Includes all the fields on the user, but replaces the password field with admin’s password hash display field.

class Meta[ソース]

ベースクラス: object

fields = ('last_name', 'first_name', 'email', 'nickname', 'avatar', 'quotes', 'gender')
model

Persona のエイリアス

PersonaAdminUpdateForm.base_fields = OrderedDict([('last_name', <django.forms.fields.CharField object at 0x7fb59fcad128>), ('first_name', <django.forms.fields.CharField object at 0x7fb59fca8f60>), ('email', <django.forms.fields.EmailField object at 0x7fb59fcad2e8>), ('nickname', <django.forms.fields.CharField object at 0x7fb59fcad470>), ('avatar', <django.forms.fields.ImageField object at 0x7fb59fcad780>), ('quotes', <django.forms.fields.CharField object at 0x7fb59fcad5c0>), ('gender', <django.forms.fields.TypedChoiceField object at 0x7fb59fcad828>), ('password', <django.contrib.auth.forms.ReadOnlyPasswordHashField object at 0x7fb59fcce518>)])
PersonaAdminUpdateForm.declared_fields = OrderedDict([('password', <django.contrib.auth.forms.ReadOnlyPasswordHashField object at 0x7fb59fcce518>)])
PersonaAdminUpdateForm.media
class kawaz.core.personas.forms.persona.PersonaChoiceField(queryset, required=True, widget=None, label=None, initial=None, help_text='', *args, **kwargs)[ソース]

ベースクラス: django.forms.models.ModelMultipleChoiceField

ラベルにニックネームが使われるようにする

label_from_instance(obj)[ソース]
class kawaz.core.personas.forms.persona.PersonaCreationForm(*args, **kwargs)[ソース]

ベースクラス: django.contrib.auth.forms.UserCreationForm

A form that creates a user, with no privileges, from the given username and password.

class Meta[ソース]

ベースクラス: object

exclude = ('role',)
model

Persona のエイリアス

PersonaCreationForm.base_fields = OrderedDict([('password', <django.forms.fields.CharField object at 0x7fb59fc9d630>), ('last_login', <django.forms.fields.DateTimeField object at 0x7fb59fc9dcc0>), ('groups', <django.forms.models.ModelMultipleChoiceField object at 0x7fb59fc9ddd8>), ('user_permissions', <django.forms.models.ModelMultipleChoiceField object at 0x7fb59fca8048>), ('username', <django.forms.fields.CharField object at 0x7fb59fca8208>), ('first_name', <django.forms.fields.CharField object at 0x7fb59fca8320>), ('last_name', <django.forms.fields.CharField object at 0x7fb59fca84a8>), ('email', <django.forms.fields.EmailField object at 0x7fb59fca8668>), ('is_active', <django.forms.fields.BooleanField object at 0x7fb59fca87f0>), ('date_joined', <django.forms.fields.DateTimeField object at 0x7fb59fca88d0>), ('nickname', <django.forms.fields.CharField object at 0x7fb59fca8978>), ('quotes', <django.forms.fields.CharField object at 0x7fb59fca8b00>), ('avatar', <django.forms.fields.ImageField object at 0x7fb59fca8cc0>), ('gender', <django.forms.fields.TypedChoiceField object at 0x7fb59fca8d68>), ('password1', <django.forms.fields.CharField object at 0x7fb59fcc4eb8>), ('password2', <django.forms.fields.CharField object at 0x7fb59fcce080>)])
PersonaCreationForm.clean_username()[ソース]
PersonaCreationForm.declared_fields = OrderedDict([('password1', <django.forms.fields.CharField object at 0x7fb59fcc4eb8>), ('password2', <django.forms.fields.CharField object at 0x7fb59fcce080>)])
PersonaCreationForm.media
class kawaz.core.personas.forms.persona.PersonaRoleForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None)[ソース]

ベースクラス: django.forms.models.ModelForm

class Meta[ソース]

ベースクラス: object

fields = ('role',)
model

Persona のエイリアス

PersonaRoleForm.base_fields = OrderedDict([('role', <django.forms.fields.TypedChoiceField object at 0x7fb59fcb1470>)])
PersonaRoleForm.declared_fields = OrderedDict()
PersonaRoleForm.media
class kawaz.core.personas.forms.persona.PersonaUpdateForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None)[ソース]

ベースクラス: django.forms.models.ModelForm

class Meta[ソース]

ベースクラス: object

exclude = ('password', 'role', 'username')
fields = ('last_name', 'first_name', 'email', 'nickname', 'avatar', 'quotes', 'gender')
model

Persona のエイリアス

PersonaUpdateForm.base_fields = OrderedDict([('last_name', <django.forms.fields.CharField object at 0x7fb59fcadb70>), ('first_name', <django.forms.fields.CharField object at 0x7fb59fcad9e8>), ('email', <django.forms.fields.EmailField object at 0x7fb59fcadd30>), ('nickname', <django.forms.fields.CharField object at 0x7fb59fcadeb8>), ('avatar', <django.forms.fields.ImageField object at 0x7fb59fcb1208>), ('quotes', <django.forms.fields.CharField object at 0x7fb59fcb1048>), ('gender', <django.forms.fields.TypedChoiceField object at 0x7fb59fcb12b0>)])
PersonaUpdateForm.declared_fields = OrderedDict()
PersonaUpdateForm.media
profile Module
class kawaz.core.personas.forms.profile.AccountForm(*args, **kwargs)[ソース]

ベースクラス: kawaz.core.forms.mixins.Bootstrap3InlineFormHelperMixin, django.forms.models.ModelForm

class Meta[ソース]

ベースクラス: object

exclude = ('user',)
fields = ('service', 'username', 'pub_state')
model

Account のエイリアス

AccountForm.base_fields = OrderedDict([('service', <django.forms.models.ModelChoiceField object at 0x7fb59fc5ae10>), ('username', <django.forms.fields.CharField object at 0x7fb59fc64518>), ('pub_state', <django.forms.fields.TypedChoiceField object at 0x7fb59fc64470>)])
AccountForm.declared_fields = OrderedDict([('service', <django.forms.models.ModelChoiceField object at 0x7fb59fc5ae10>)])
AccountForm.form_tag = False
AccountForm.media
class kawaz.core.personas.forms.profile.ProfileForm(*args, **kwargs)[ソース]

ベースクラス: kawaz.core.forms.mixins.Bootstrap3HorizontalFormHelperMixin, django.forms.models.ModelForm

class Meta[ソース]

ベースクラス: object

exclude = ('user', 'created_at', 'updated_at')
model

Profile のエイリアス

ProfileForm.base_fields = OrderedDict([('pub_state', <django.forms.fields.TypedChoiceField object at 0x7fb59fc4b8d0>), ('birthday', <django.forms.fields.DateField object at 0x7fb59fc4b438>), ('place', <django.forms.fields.CharField object at 0x7fb59fc5ac18>), ('url', <django.forms.fields.URLField object at 0x7fb59fc5ad68>), ('remarks', <kawaz.core.forms.fields.MarkdownField object at 0x7fb59fcc1860>), ('skills', <django.forms.models.ModelMultipleChoiceField object at 0x7fb59fcb19e8>)])
ProfileForm.declared_fields = OrderedDict([('skills', <django.forms.models.ModelMultipleChoiceField object at 0x7fb59fcb19e8>), ('remarks', <kawaz.core.forms.fields.MarkdownField object at 0x7fb59fcc1860>), ('birthday', <django.forms.fields.DateField object at 0x7fb59fc4b438>)])
ProfileForm.form_tag = False
ProfileForm.get_additional_objects()[ソース]
ProfileForm.media
class kawaz.core.personas.forms.profile.ServiceSelectWidget(attrs=None, choices=())[ソース]

ベースクラス: django.forms.widgets.Select

サービスを選択するフォームセットのサービスを選択するフィールド用のWidget 選択項目にサービスのfaviconが埋め込まれるようになっている

media
render_option(selected_choices, option_value, option_label)[ソース]
render_options(*args, **kwargs)[ソース]
migrations Package
0001_initial Module
class kawaz.core.personas.migrations.0001_initial.Migration(name, app_label)[ソース]

ベースクラス: django.db.migrations.migration.Migration

dependencies = [('auth', '0001_initial')]
operations = [<CreateModel options={'ordering': ('username',), 'permissions': (('activate_persona', 'Can activate/deactivate the persona'), ('assign_role_persona', 'Can assign the role to the persona')), 'verbose_name': 'Persona', 'verbose_name_plural': 'Personas'}, fields=[('id', <django.db.models.fields.AutoField>), ('password', <django.db.models.fields.CharField>), ('last_login', <django.db.models.fields.DateTimeField>), ('username', <django.db.models.fields.CharField>), ('first_name', <django.db.models.fields.CharField>), ('last_name', <django.db.models.fields.CharField>), ('email', <django.db.models.fields.EmailField>), ('is_active', <django.db.models.fields.BooleanField>), ('date_joined', <django.db.models.fields.DateTimeField>), ('nickname', <django.db.models.fields.CharField>), ('quotes', <django.db.models.fields.CharField>), ('avatar', <thumbnailfield.fields.ThumbnailField>), ('gender', <django.db.models.fields.CharField>), ('role', <django.db.models.fields.CharField>)], bases=(<class 'django.db.models.base.Model'>,), name='Persona'>, <CreateModel options={'permissions': (('view_account', 'Can view the account'),), 'verbose_name': 'Account', 'verbose_name_plural': 'Accounts'}, fields=[('id', <django.db.models.fields.AutoField>), ('pub_state', <django.db.models.fields.CharField>), ('username', <django.db.models.fields.CharField>)], bases=(<class 'django.db.models.base.Model'>,), name='Account'>, <CreateModel options={'ordering': ('user__nickname',), 'permissions': (('view_profile', 'Can view the profile'),), 'verbose_name': 'Profile', 'verbose_name_plural': 'Profiles'}, fields=[('pub_state', <django.db.models.fields.CharField>), ('birthday', <django.db.models.fields.DateField>), ('place', <django.db.models.fields.CharField>), ('url', <django.db.models.fields.URLField>), ('remarks', <django.db.models.fields.TextField>), ('user', <django.db.models.fields.related.OneToOneField>), ('created_at', <django.db.models.fields.DateTimeField>), ('updated_at', <django.db.models.fields.DateTimeField>)], bases=(<class 'django.db.models.base.Model'>,), name='Profile'>, <CreateModel options={'ordering': ('pk',), 'verbose_name': 'Service', 'verbose_name_plural': 'Services'}, fields=[('id', <django.db.models.fields.AutoField>), ('label', <django.db.models.fields.CharField>), ('icon', <django.db.models.fields.files.ImageField>), ('url_pattern', <django.db.models.fields.CharField>)], bases=(<class 'django.db.models.base.Model'>,), name='Service'>, <CreateModel options={'ordering': ('order', 'pk'), 'verbose_name': 'Skill', 'verbose_name_plural': 'Skills'}, fields=[('id', <django.db.models.fields.AutoField>), ('label', <django.db.models.fields.CharField>), ('description', <django.db.models.fields.CharField>), ('order', <django.db.models.fields.IntegerField>)], bases=(<class 'django.db.models.base.Model'>,), name='Skill'>, <AddField preserve_default=True, model_name='profile', name='skills', field=<django.db.models.fields.related.ManyToManyField>>, <AddField preserve_default=True, model_name='account', name='profile', field=<django.db.models.fields.related.ForeignKey>>, <AddField preserve_default=True, model_name='account', name='service', field=<django.db.models.fields.related.ForeignKey>>, <AlterUniqueTogether unique_together={('service', 'username')}, name='account'>, <AddField preserve_default=True, model_name='persona', name='groups', field=<django.db.models.fields.related.ManyToManyField>>, <AddField preserve_default=True, model_name='persona', name='user_permissions', field=<django.db.models.fields.related.ManyToManyField>>]
0002_test Module
class kawaz.core.personas.migrations.0002_test.Migration(name, app_label)[ソース]

ベースクラス: django.db.migrations.migration.Migration

dependencies = [('personas', '__first__'), ('personas', '0001_initial')]
operations = []
models Package
models Package
persona Module
class kawaz.core.personas.models.persona.ActivePersonaManager[ソース]

ベースクラス: kawaz.core.personas.models.persona.PersonaManager

アクティブユーザーのみを取り出すManager

get_queryset()[ソース]
class kawaz.core.personas.models.persona.Persona(*args, **kwargs)[ソース]

ベースクラス: django.contrib.auth.models.AbstractUser

Kawazで利用する認証用カスタムユーザーモデル

このユーザーモデルはDjangoデフォルトのモデルと異なり`is_staff`と `is_superuser`の値をDB上に保持しない。代わりにこれらの値は`role`の値から 自動的に決定され、プロパティとして提供される

exception DoesNotExist

ベースクラス: django.core.exceptions.ObjectDoesNotExist

Persona.GENDER_TYPES = (('man', <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7fb59fda4358>), ('woman', <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7fb59fda4320>), ('unknown', <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7fb59fda4438>))
exception Persona.MultipleObjectsReturned

ベースクラス: django.core.exceptions.MultipleObjectsReturned

Persona.ROLE_TYPES = (('adam', <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7fb59fda42b0>), ('seele', <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7fb5a0fae6a0>), ('nerv', <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7fb5a0fae588>), ('children', <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7fb5a0fae828>), ('wille', <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7fb5a0fae7f0>))
Persona.actives = <kawaz.core.personas.models.persona.ActivePersonaManager object>
Persona.avatar

Enhanced ImageFileDescriptor

Just like the ImageFileDescriptor, but for ThumbnailField. The only difference is removing previous Image and Thumbnails from storage when the value has changed.

Persona.blog_categories

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Persona.blog_entries

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Persona.clean_fields(exclude=None, **kwargs)[ソース]
Persona.comment_comments

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Persona.comment_flags

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Persona.commenttestarticle_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Persona.created_announcements

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Persona.events_attend

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

pizza.toppings and topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Persona.events_owned

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Persona.gender

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Persona.get_absolute_url()[ソース]
Persona.get_avatar(size)[ソース]

渡したサイズのアバターURLを返します 未設定の場合や、見つからない場合はデフォルトアバターを返します

Persona.get_default_avatar(size)[ソース]

デフォルトアバターを返します

Persona.get_gender_display(*moreargs, **morekwargs)
Persona.get_grayscale_avatar()
Persona.get_huge_avatar()
Persona.get_large_avatar()
Persona.get_middle_avatar()
Persona.get_next_by_date_joined(*moreargs, **morekwargs)
Persona.get_previous_by_date_joined(*moreargs, **morekwargs)
Persona.get_role_display(*moreargs, **morekwargs)
Persona.get_small_avatar()
Persona.groups

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

pizza.toppings and topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Persona.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Persona.is_member
Persona.is_staff
Persona.is_superuser
Persona.last_modified_announcements

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Persona.last_modified_products

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Persona.last_modified_projects

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Persona.logentry_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Persona.material_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Persona.nickname

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Persona.objects = <kawaz.core.personas.models.persona.PersonaManager object>
Persona.product_set

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

pizza.toppings and topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Persona.projects_joined

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

pizza.toppings and topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Persona.projects_owned

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Persona.quotes

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Persona.registration_profile

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

place.restaurant is a ReverseOneToOneDescriptor instance.

Persona.role

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Persona.save(*args, **kwargs)
Persona.star_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Persona.startestarticle_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Persona.user_permissions

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

pizza.toppings and topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class kawaz.core.personas.models.persona.PersonaBase(class_name, bases, namespace)[ソース]

ベースクラス: django.db.models.base.ModelBase

AbstractUser`から継承されたために自動作成される`is_staff`や`is_superuser フィールドを強制的に削除するためのメタクラス

`Persona`モデルは`role`フィールドを持ち、その値により`is_staff`や `is_superuser`の値を決定するためDB上にこれらの値を保持する必要性がない。

class kawaz.core.personas.models.persona.PersonaManager[ソース]

ベースクラス: django.contrib.auth.base_user.BaseUserManager

Persona用カスタムマネージャ

PersonaモデルはDjangoがデフォルトで利用する is_staffis_superuser を DBレベルで廃止しているため、このカスタムが必要

PersonaManagerでは`role`によりユーザーとスーパーユーザを区別しているため create_superuser`で作成されたユーザーは`role`が‘adam’になり、その他の 場合は‘wille’`となる。

create_superuser(username, email, password, **extra_fields)[ソース]
create_user(username, email=None, password=None, **extra_fields)[ソース]
retired()[ソース]
kawaz.core.personas.models.persona.invite_to_slack(user, profile, request, **kwargs)[ソース]
profile Module
class kawaz.core.personas.models.profile.Account(id, profile, service, pub_state, username)[ソース]

ベースクラス: django.db.models.base.Model

exception DoesNotExist

ベースクラス: django.core.exceptions.ObjectDoesNotExist

exception Account.MultipleObjectsReturned

ベースクラス: django.core.exceptions.MultipleObjectsReturned

Account.get_pub_state_display(*moreargs, **morekwargs)
Account.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Account.objects = <django.db.models.manager.Manager object>
Account.profile

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Account.profile_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Account.pub_state

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Account.service

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Account.service_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Account.url
Account.username

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class kawaz.core.personas.models.profile.Profile(*args, **kwargs)[ソース]

ベースクラス: django.db.models.base.Model

It is the model which indicates profiles of each users

exception DoesNotExist

ベースクラス: django.core.exceptions.ObjectDoesNotExist

exception Profile.MultipleObjectsReturned

ベースクラス: django.core.exceptions.MultipleObjectsReturned

Profile.PUB_STATES = (('public', <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7fb59fdb4908>), ('protected', <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7fb59fdb4978>))
Profile.accounts

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Profile.birthday

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Profile.created_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Profile.get_absolute_url()[ソース]
Profile.get_next_by_created_at(*moreargs, **morekwargs)
Profile.get_next_by_updated_at(*moreargs, **morekwargs)
Profile.get_previous_by_created_at(*moreargs, **morekwargs)
Profile.get_previous_by_updated_at(*moreargs, **morekwargs)
Profile.get_pub_state_display(*moreargs, **morekwargs)
Profile.objects = <kawaz.core.personas.models.profile.ProfileManager object>
Profile.place

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Profile.pub_state

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Profile.remarks

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Profile.skills

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

pizza.toppings and topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Profile.updated_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Profile.url

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Profile.user

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Profile.user_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class kawaz.core.personas.models.profile.ProfileManager[ソース]

ベースクラス: django.db.models.manager.Manager

active()[ソース]

Returns the QuerySet which contains all active profiles

published(user)[ソース]

Return the QuerySet which contains all active viewable profiles by passed user.

class kawaz.core.personas.models.profile.Service(id, label, icon, url_pattern)[ソース]

ベースクラス: django.db.models.base.Model

exception DoesNotExist

ベースクラス: django.core.exceptions.ObjectDoesNotExist

exception Service.MultipleObjectsReturned

ベースクラス: django.core.exceptions.MultipleObjectsReturned

Service.accounts

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Service.active_accounts
Service.get_absolute_url()[ソース]
Service.icon

Just like the FileDescriptor, but for ImageFields. The only difference is assigning the width/height to the width_field/height_field, if appropriate.

Service.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Service.label

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Service.objects = <django.db.models.manager.Manager object>
Service.url_pattern

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class kawaz.core.personas.models.profile.Skill(*args, **kwargs)[ソース]

ベースクラス: django.db.models.base.Model

It is the model which indicates what users can

exception DoesNotExist

ベースクラス: django.core.exceptions.ObjectDoesNotExist

exception Skill.MultipleObjectsReturned

ベースクラス: django.core.exceptions.MultipleObjectsReturned

Skill.description

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Skill.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Skill.label

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Skill.objects = <django.db.models.manager.Manager object>
Skill.order

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Skill.users

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

pizza.toppings and topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

templatetags Package
templatetags Package
profiles_tags Module
kawaz.core.personas.templatetags.profiles_tags.get_my_profile(context)[ソース]

現在のログインユーザーのプロフィールを取り出すテンプレートタグ セキュリティの観点から、任意のユーザーのプロフィール情報を取り出すことはできず、 必ずログインユーザーの物が返される もし、ログインユーザーがプロフィールを持っていなかったり(wille)、 渡されたユーザーが非ログインユーザーだった場合は`None`を返す

Example

{% load profiles_tags %} {% get_my_profile as profile %} {{ profile.remarks }}

kawaz.core.personas.templatetags.profiles_tags.get_profile(context, user)[ソース]

特定のユーザーのプロフィールを取り出すテンプレートタグ セッションに含まれる現在のログインユーザーを取得し、 対象プロフィールの閲覧権限がある場合のみ取得できる パーミッションがない場合は`None`を返す

Example

{% load profiles_tags %} {% get_profile user as profile %} {{ profile.remarks }}

tests Package
models Module
class kawaz.core.personas.tests.models.PersonaTestArticle(id, pub_state, title, author)[ソース]

ベースクラス: django.db.models.base.Model

exception DoesNotExist

ベースクラス: django.core.exceptions.ObjectDoesNotExist

exception PersonaTestArticle.MultipleObjectsReturned

ベースクラス: django.core.exceptions.MultipleObjectsReturned

PersonaTestArticle.author

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

PersonaTestArticle.author_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

PersonaTestArticle.get_pub_state_display(*moreargs, **morekwargs)
PersonaTestArticle.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

PersonaTestArticle.objects = <django.db.models.manager.Manager object>
PersonaTestArticle.pub_state

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

PersonaTestArticle.title

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

test_activity Module
test_mails Module
class kawaz.core.personas.tests.test_mails.PersonaPasswordResetMailTemplateTestCase(methodName='runTest')[ソース]

ベースクラス: django.test.testcases.TestCase

test_email_parse()[ソース]

registration/password_reset_email.htmlを正しくparseできる

test_email_subject_parse()[ソース]

registration/password_reset_email_subject.txtを正しくparseできる

test_templatetags Module
utils Module
Subpackages
factories Package
factories Package
persona Module
profile Module
test_models Package
test_models Package
test_persona Module
test_profile Module
test_perms Package
test_perms Package
test_persona Module
test_profile Module
test_views Package
test_persona Module
test_profile Module
views Package
views Package
persona Module
class kawaz.core.personas.views.persona.AssignRoleMixin[ソース]

ベースクラス: object

get(request, *args, **kwargs)[ソース]
get_object(queryset=None)[ソース]
get_queryset()[ソース]
get_success_message(cleaned_data)[ソース]
get_success_url()[ソース]
model

Persona のエイリアス

post(request, *args, **kwargs)[ソース]
role = None
class kawaz.core.personas.views.persona.PersonaAssignAdamView(**kwargs)[ソース]

ベースクラス: kawaz.core.personas.views.persona.AssignRoleMixin, django.views.generic.edit.UpdateView

アダムに昇格するためのビュー

role = 'adam'
class kawaz.core.personas.views.persona.PersonaAssignSeeleView(**kwargs)[ソース]

ベースクラス: kawaz.core.personas.views.persona.AssignRoleMixin, django.views.generic.edit.UpdateView

ゼーレに降格するためのビュー

role = 'seele'
class kawaz.core.personas.views.persona.PersonaDetailView(**kwargs)[ソース]

ベースクラス: django.views.generic.detail.DetailView

get_context_data(**kwargs)[ソース]
get_queryset()[ソース]
model

Persona のエイリアス

slug_field = 'username'
class kawaz.core.personas.views.persona.PersonaListView(**kwargs)[ソース]

ベースクラス: django_filters.views.FilterView

filterset_class

PersonaFilter のエイリアス

get_context_data(**kwargs)[ソース]
get_queryset()[ソース]
model

Persona のエイリアス

paginate_by = 24
template_name_suffix = '_list'
class kawaz.core.personas.views.persona.PersonaRetiredView(**kwargs)[ソース]

ベースクラス: django.views.generic.list.ListView

dispatch(request, *args, **kwargs)
get_queryset()[ソース]
template_name = 'personas/persona_retired.html'
class kawaz.core.personas.views.persona.PersonaUpdateView(**kwargs)[ソース]

ベースクラス: django.contrib.messages.views.SuccessMessageMixin, django.views.generic.edit.UpdateView

dispatch(request, *args, **kwargs)
form_class

PersonaUpdateForm のエイリアス

get_object(queryset=None)[ソース]
get_queryset()[ソース]
get_success_message(cleaned_data)[ソース]
model

Persona のエイリアス

template_name = 'personas/persona_form.html'
profile Module
class kawaz.core.personas.views.profile.ProfilePreviewView(**kwargs)[ソース]

ベースクラス: kawaz.core.views.preview.SingleObjectPreviewViewMixin, django.views.generic.detail.DetailView

model

Profile のエイリアス

template_name = 'personas/profile_preview.html'
class kawaz.core.personas.views.profile.ProfileUpdateView(**kwargs)[ソース]

ベースクラス: django.contrib.messages.views.SuccessMessageMixin, django.views.generic.edit.UpdateView

dispatch(request, *args, **kwargs)
form_class

ProfileForm のエイリアス

form_invalid(form, formset)[ソース]
form_valid(form, formset)[ソース]
formset_prefix = 'accounts'
get(request, *args, **kwargs)[ソース]
get_formset()[ソース]
get_object(queryset=None)[ソース]
get_queryset()[ソース]
get_success_message(cleaned_data)[ソース]
get_success_url()[ソース]
model

Profile のエイリアス

post(request, *args, **kwargs)[ソース]
template_name = 'personas/profile_form.html'
publishments Package
publishments Package
lookups Module
kawaz.core.publishments.lookups.draft_lookup(user_obj, author_field_name='author', field_name='pub_state')[ソース]

指定されたユーザーが編集可能な下書きオブジェクトをフィルタするための Qオブジェクトを返す

ユーザーがメンバーであれば、自身が保有する下書き状態のオブジェクトを返し それ以外であれば何も返さない。なおユーザーがsuperuserの場合は存在する あらゆる下書き状態のオブジェクトを返す(superuserはあらゆる権限を持つため 全ての下書き記事の編集権限を持つ)

パラメタ:
  • user_obj (obj) – Userモデルインスタンス(or AnonymousUser)
  • author_field_name (str) – 所有者を指定しているフィールド名 (デフォルト: 'author'
  • field_name (str) – 公開状態を指定しているフィールド名 (デフォルト: 'pub_state'
戻り値:

Qオブジェクトインスタンス

kawaz.core.publishments.lookups.published_lookup(user_obj, field_name='pub_state')[ソース]

指定されたユーザーが閲覧可能な公開オブジェクトをフィルタするための Qオブジェクトを返す

ユーザーがメンバーであれば、publicおよびprotected指定のオブジェクトを返し それ以外であればpublic指定のオブジェクトを返す

パラメタ:
  • user_obj (obj) – Userモデルインスタンス(or AnonymousUser)
  • field_name (str) – 公開状態を指定しているフィールド名 (デフォルト: 'pub_state'
戻り値:

Qオブジェクトインスタンス

models Module
class kawaz.core.publishments.models.PublishmentManagerMixin[ソース]

ベースクラス: object

A model manager mixin for AbstractPublishmentModel model.

author_field_name = 'author'
draft(user)[ソース]

Return a queryset which include the draft objects of the specified user.

published(user)[ソース]

Return a queryset which include the objects published to the specified user.

A queryset which include public/protected objects would be returend if the specified user is the member of Kawaz, otherwise it only include the public objects.

related(user)[ソース]

Return a queryset which include the objects related to the specified user, namely an union of the published and draft queryset.

perms Module
class kawaz.core.publishments.perms.PublishmentPermissionLogic(author_field_name='author', pub_state_field_name='pub_state')[ソース]

ベースクラス: permission.logics.base.PermissionLogic

Permission logic of AbstractPublishmentModel subclass. This permission logic handle the ‘view’ permission based on the publishment status

has_perm(user_obj, perm, obj=None)[ソース]

Check if user have view permission (of object) based on the pub_state and author of the instance.

If no object is specified, it always return True.

If an object is specified, it will return True when the pub_state of the instance is:

  • ‘public’ | Anyone can see this obj
  • ‘protected’ | Seele, Nerv, Children can see this obj
  • ‘draft’ | Nobody but the obj author can see this obj
パラメタ:
  • user_obj (django user model instance) – A django user model instance which be checked
  • perm (string) – app_label.codename formatted permission string
  • obj (None or django model instance) – None or django model instance for object permission
戻り値:

Wheter the specified user have specified permission (of specified object).

戻り値の型:

boolean

Subpackages
migrations Package
0001_test Module
class kawaz.core.publishments.migrations.0001_test.Migration(name, app_label)[ソース]

ベースクラス: django.db.migrations.migration.Migration

dependencies = [('personas', '__first__')]
operations = []
tests Package
tests Package
models Module
class kawaz.core.publishments.tests.models.PublishmentTestArticle(id, pub_state, author, title)[ソース]

ベースクラス: django.db.models.base.Model

exception DoesNotExist

ベースクラス: django.core.exceptions.ObjectDoesNotExist

exception PublishmentTestArticle.MultipleObjectsReturned

ベースクラス: django.core.exceptions.MultipleObjectsReturned

PublishmentTestArticle.author

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

PublishmentTestArticle.author_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

PublishmentTestArticle.get_pub_state_display(*moreargs, **morekwargs)
PublishmentTestArticle.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

PublishmentTestArticle.objects = <django.db.models.manager.Manager object>
PublishmentTestArticle.pub_state

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

PublishmentTestArticle.title

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

test_lookups Module
test_perms Module
class kawaz.core.publishments.tests.test_perms.PublishmentPermissionLogicTestCase(methodName='runTest')[ソース]

ベースクラス: django.test.testcases.TestCase

setUp()[ソース]
test_view_permission_with_draft()[ソース]

Nobody except the author and adam can see the draft model

test_view_permission_with_protected()[ソース]

Authenticated user except wille can see the protected model

test_view_permission_with_public()[ソース]

Anyone can see the public model

test_view_permission_without_obj()[ソース]

Anyone have a potential to see the model

registrations Package
registrations Package
backends Module
class kawaz.core.registrations.backends.KawazRegistrationBackend[ソース]

ベースクラス: registration.backends.default.DefaultRegistrationBackend

get_registration_form_class()[ソース]
forms Module
class kawaz.core.registrations.forms.KawazRegistrationForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[ソース]

ベースクラス: registration.forms.RegistrationFormTermsOfService

base_fields = OrderedDict([('username', <django.forms.fields.RegexField object at 0x7fb59fc8eef0>), ('email1', <django.forms.fields.EmailField object at 0x7fb59fc8ea20>), ('email2', <django.forms.fields.EmailField object at 0x7fb59fc8eb00>), ('tos', <django.forms.fields.BooleanField object at 0x7fb59fc8ec88>)])
declared_fields = OrderedDict([('username', <django.forms.fields.RegexField object at 0x7fb59fc8eef0>), ('email1', <django.forms.fields.EmailField object at 0x7fb59fc8ea20>), ('email2', <django.forms.fields.EmailField object at 0x7fb59fc8eb00>), ('tos', <django.forms.fields.BooleanField object at 0x7fb59fc8ec88>)])
media
models Module
class kawaz.core.registrations.models.RegistrationSupplement(id, registration_profile, place, skill, remarks)[ソース]

ベースクラス: registration.supplements.base.RegistrationSupplementBase

exception DoesNotExist

ベースクラス: django.core.exceptions.ObjectDoesNotExist

exception RegistrationSupplement.MultipleObjectsReturned

ベースクラス: django.core.exceptions.MultipleObjectsReturned

RegistrationSupplement.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

RegistrationSupplement.objects = <django.db.models.manager.Manager object>
RegistrationSupplement.place

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

RegistrationSupplement.registration_profile

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

RegistrationSupplement.remarks

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

RegistrationSupplement.skill

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

kawaz.core.registrations.models.setup_for_participation(sender, user, password, is_generated, request, **kwargs)[ソース]
perms Module
class kawaz.core.registrations.perms.RegistrationProfilePermissionLogic[ソース]

ベースクラス: permission.logics.base.PermissionLogic

has_perm(user_obj, perm, obj=None)[ソース]
urls Module
Subpackages
migrations Package
0001_initial Module
class kawaz.core.registrations.migrations.0001_initial.Migration(name, app_label)[ソース]

ベースクラス: django.db.migrations.migration.Migration

dependencies = [('registration', '__first__')]
operations = [<CreateModel options={'abstract': False}, fields=[('id', <django.db.models.fields.AutoField>), ('place', <django.db.models.fields.CharField>), ('skill', <django.db.models.fields.TextField>), ('remarks', <django.db.models.fields.TextField>), ('registration_profile', <django.db.models.fields.related.OneToOneField>)], bases=(<class 'django.db.models.base.Model'>,), name='RegistrationSupplement'>]
tests Package
tests Package
factories Module
test_emails Module
class kawaz.core.registrations.tests.test_emails.RegistrationMailTemplateTestCase(methodName='runTest')[ソース]

ベースクラス: django.test.testcases.TestCase

test_acceptance_parse()[ソース]

registration/acceptance_email.txtを正しくparseできる

test_acceptance_subject_parse()[ソース]

registration/acceptance_email_subject.txtを正しくparseできる

test_notification_parse()[ソース]

registration/notification_email.txtを正しくparseできる

test_notification_subject_parse()[ソース]

registration/notification_email_subject.txtを正しくparseできる

test_registration_parse()[ソース]

registration/registration_email.txtを正しくparseできる

test_registration_subject_parse()[ソース]

registration/registration_email_subject.txtを正しくparseできる

test_rejection_parse()[ソース]

registration/rejection_email.txtを正しくparseできる

test_rejection_subject_parse()[ソース]

registration/rejection_email_subject.txtを正しくparseできる

test_perms Module
test_signals Module
class kawaz.core.registrations.tests.test_signals.RegistrationActivatedTestCase(methodName='runTest')[ソース]

ベースクラス: django.test.testcases.TestCase

setUp()[ソース]
test_activated_user_should_be_children()[ソース]

新規会員登録が承認されたユーザーのactivationが行われたとき、 signalを受けて権限をwilleからchildrenに変更する

test_profile_should_be_created_on_activation()[ソース]

新規会員登録が承認されたとき、profileが生成される

test_views Module
templatetags Package
templatetags Package
Subpackages
templatetags Package
expr Module
class kawaz.core.templatetags.templatetags.expr.ExprNode(expression, variable=None)[ソース]

ベースクラス: django.template.base.Node

render(context)[ソース]
kawaz.core.templatetags.templatetags.expr.do_expr(parser, token)[ソース]

テンプレート内でPythonの機能を実行し描画 or 変数代入するタグ

Syntax:
{% expr <expression> (as <variable) %}

Example

{# 2 を描画 #} {% expr 1 + 1 %} {# 10 を foo に代入 #} {% expr 1 + 9 as foo %} {# foo を使って掛け算し描画 #} {% expr foo * 100 %}

strip_newlines Module
kawaz.core.templatetags.templatetags.strip_newlines.strip_newlines(value, repl='')[ソース]

指定されたテキストから改行文字を取り除くテンプレートフィルタ

Usage:
{{ object.body | strip_newlines }} {{ object.body | strip_newlines:’ ‘ }} # 半角スペースに置換
utils Module
kawaz.core.templatetags.templatetags.utils.active(context, pattern)[ソース]

現在のURLのregexを渡して、一致していた場合は’active’を返します そうでない場合は空白文字を返します param pattern 現在のURLの正規表現パターン

また、GETパラメーターが与えられている場合、keyの昇順に連結されたURLで判定します /members/kawaz_tan/?a=1&b=2&c=3

Example

{% load utils %} <div class=”{% active ‘/members/.+’ %}”</div>

例えば、このように記述しておくと、bootstrapのタブなど、「特定のページにいるときだけactiveクラスを付加したい」 という需要に対応できます

kawaz.core.templatetags.templatetags.utils.get_current_site()[ソース]

現在のSiteオブジェクトを取得します

kawaz.core.templatetags.templatetags.utils.get_week_day(date)[ソース]

datetimeオブジェクトを受け取り、曜日に応じてCSSクラス名を返します

Param
date [datetime]
Return [string]
土曜日 saturday 日曜日 sunday その他 weekday
Example
{% load utils %} <div class=”{% get_week_day date”>{{ date }}</div>
tests Package
tests Package
test_builtin Module
class kawaz.core.templatetags.tests.test_builtin.CustomBuiltInTemplateTagTestCase(methodName='runTest')[ソース]

ベースクラス: django.test.testcases.TestCase

test_kfm()[ソース]

kfmがbuilt in template-filter化されている

test_expr Module
class kawaz.core.templatetags.tests.test_expr.ExprTemplateTagTestCase(methodName='runTest')[ソース]

ベースクラス: django.test.testcases.TestCase

test_expr_render()[ソース]

expr タグを利用して計算結果を代入可能

test_strip_newlines Module
class kawaz.core.templatetags.tests.test_strip_newlines.StripNewlinesTemplateFilterTestCase(methodName='runTest')[ソース]

ベースクラス: django.test.testcases.TestCase

test_strip_newlines()[ソース]

strip_newlinesフィルタで改行文字の置換が可能

test_utils Module
class kawaz.core.templatetags.tests.test_utils.ActiveTemplateTagTestCase(methodName='runTest')[ソース]

ベースクラス: django.test.testcases.TestCase

test_active()[ソース]

activeタグのpatternが現在のURLとマッチしたとき、activeの文字を返す

test_active_contains_get_parameter()[ソース]

activeタグはGETパラメータの値も含む

test_active_with_not_matched_pattern()[ソース]

activeタグのpatternが現在のURLとマッチしないとき、空白文字を返す

class kawaz.core.templatetags.tests.test_utils.GetCurrentSiteTagTestCase(methodName='runTest')[ソース]

ベースクラス: django.test.testcases.TestCase

test_get_current_site()[ソース]

get_current_siteで現在のSiteを返す

class kawaz.core.templatetags.tests.test_utils.GetWeekDayTemplateTagTestCase(methodName='runTest')[ソース]

ベースクラス: django.test.testcases.TestCase

test_saturday()[ソース]

get_week_dayで土曜だったときにsaturdayを返す

test_sunday()[ソース]

get_week_dayで日曜だったときにsundayを返す

test_weekday()[ソース]

get_week_dayで平日だったときにweekdayを返す

tests Package
runner Module
class kawaz.core.tests.runner.KawazDiscoverRunner(pattern=None, top_level=None, verbosity=1, interactive=True, failfast=False, keepdb=False, reverse=False, debug_sql=False, parallel=0, tags=None, exclude_tags=None, **kwargs)[ソース]

ベースクラス: kawaz.core.tests.runner.MediaRootTestSuiteRunner

setup_test_environment()[ソース]
class kawaz.core.tests.runner.MediaRootTestSuiteRunner(pattern=None, top_level=None, verbosity=1, interactive=True, failfast=False, keepdb=False, reverse=False, debug_sql=False, parallel=0, tags=None, exclude_tags=None, **kwargs)[ソース]

ベースクラス: kawaz.core.tests.runner.TempMediaMixin, django.test.runner.DiscoverRunner

Local test suite runner.

class kawaz.core.tests.runner.TempMediaMixin[ソース]

ベースクラス: object

Mixin to create MEDIA_ROOT in temp and tear down when complete. cf. http://www.caktusgroup.com/blog/2013/06/26/media-root-and-django-tests/

setup_test_environment()[ソース]

Create temp directory and update MEDIA_ROOT and default storage.

teardown_test_environment()[ソース]

Delete temp storage.

Subpackages
testcases Package
testcases Package
permissions Module
views Module
utils Package
utils Package
models Module
permission Module
kawaz.core.utils.permission.check_object_permission(user_obj, codename, obj)[ソース]

指定ユーザが省略形パーミッションを指定オブジェクトに対して持つか調べる

パラメタ:
  • user_obj (user instance) – 対象ユーザインスタンス
  • codename (str) – 省略形パーミッション(例: ‘add’
  • obj (model instance) – 対象モデルインスタンス
戻り値:

指定されたパーミッションが存在する場合は`True`/`False`を

返し、存在しない場合は`None`を返す

戻り値の型:

bool or None

kawaz.core.utils.permission.filter_with_perm(user_obj, qs, codename)[ソース]

指定された省略形パーミッションを持つオブジェクトをフィルタリング

パラメタ:
  • user_obj (user instance) – 対象ユーザインスタンス
  • qs (obj) – QuerySetのインスタンスもしくはオブジェクトリスト
  • codename (str) – 省略形パーミッション(例: ‘add’)もしくは パーミッションの完全名
Notice:
`qs`にオブジェクトリストを渡す場合は`codename`はパーミッションの完全名 である必要がある。 また、この関数は全てのオブジェクトをいてレートするイテレータを返すため 結果をリスト化する際に全てのオブジェクトを評価する。 このためオブジェクト数が多い場合は計算時間がかかるので注意。
戻り値:フィルタしたオブジェクトイテレータ
戻り値の型:iterator
kawaz.core.utils.permission.get_full_permission_name(codename, obj)[ソース]

省略形パーミッションとオブジェクトからパーミッションの完全名を取得

パラメタ:
  • codename (str) – 省略形パーミッション(例: ‘add’
  • obj (model instance) – 対象モデルインスタンス
戻り値:

パーミッションの完全名(例: ‘auth.add_user’

戻り値の型:

str

views Package
delete Module
class kawaz.core.views.delete.DeleteSuccessMessageMixin[ソース]

ベースクラス: object

削除時に、削除通知を出すMixin SuccessMessageMixinはDeleteViewには使えないので、自前で実装している

Ref : http://stackoverflow.com/questions/24822509/success-message-in-deleteview-not-shown

Usage:
class EntryDeleteView(DeleteSuccessMessageMixin, DeleteView):
success_message = ‘Entry successfully deleted.’
delete(request, *args, **kwargs)[ソース]
get_success_message()[ソース]
success_message = ''
preview Module
class kawaz.core.views.preview.SingleObjectPreviewViewMixin[ソース]

ベースクラス: object

プレビューを行うためのViewを作るMixin

SingleObjectMixin と共に使用することが前提で、SingleObjectMixin にて定義 される get_object(queryset=None) メソッドを上書きする。 上記上書きされたメソッドは POST にて渡されたパラメータを元に仮想モデル インスタンスを生成し返すため、このMixinが適用されたビューはモデルの保存 などを行わずしてテンプレートにてモデルインスタンスのように扱うことが可能

注釈

実際に返されるオブジェクトは辞書であるためテンプレート以外では動かない

RESTの原則的にはGETで行うのがふさわしいが、GETだと、長い本文を送信したときに 413エラーを送出してしまうため、POSTで行っている

get_object(queryset=None)[ソース]

POSTで渡された値を元に仮想オブジェクトを構築し返す

post(request, *args, **kwargs)[ソース]
Subpackages
tests Package
tests Package
models Module
kawaz.core.views.tests.models.Article

SingleObjectPreviewViewMixinTestArticle のエイリアス

class kawaz.core.views.tests.models.SingleObjectPreviewViewMixinTestArticle(id, foo, bar)[ソース]

ベースクラス: django.db.models.base.Model

exception DoesNotExist

ベースクラス: django.core.exceptions.ObjectDoesNotExist

exception SingleObjectPreviewViewMixinTestArticle.MultipleObjectsReturned

ベースクラス: django.core.exceptions.MultipleObjectsReturned

SingleObjectPreviewViewMixinTestArticle.bar

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

SingleObjectPreviewViewMixinTestArticle.foo

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

SingleObjectPreviewViewMixinTestArticle.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

SingleObjectPreviewViewMixinTestArticle.objects = <django.db.models.manager.Manager object>
kawaz.core.views.tests.models.alias(name)[ソース]

Define alias name of the class

test_preview Module
class kawaz.core.views.tests.test_preview.KawazSingleObjectPreviewViewMixinTestCase(methodName='runTest')[ソース]

ベースクラス: django.test.testcases.TestCase

setUp()[ソース]
test_get_object_with_get_queryset()[ソース]

Modelに存在しないアトリビュートは削除される (get_queryset)

test_get_object_with_model()[ソース]

Modelに存在しないアトリビュートは削除される (model)

test_get_object_with_queryset()[ソース]

Modelに存在しないアトリビュートは削除される (queryset)

test_has_get_object_method()[ソース]

get_objectメソッドを所有する

test_roughpages Module
test_statics Module
class kawaz.core.views.tests.test_statics.ErrorPageTestCase(methodName='runTest')[ソース]

ベースクラス: django.test.testcases.TestCase

test_render_404()[ソース]

本番環境でカスタム404ページが描画できる